youtubei 1.3.7 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cjs/common/shared/HTTP/HTTP.js +18 -7
  2. package/dist/cjs/youtube/BaseVideo/BaseVideoParser.js +7 -2
  3. package/dist/cjs/youtube/BaseVideo/VideoCaptions.js +81 -0
  4. package/dist/cjs/youtube/BaseVideo/index.js +1 -0
  5. package/dist/cjs/youtube/Caption/Caption.js +17 -0
  6. package/dist/cjs/youtube/Caption/CaptionLanguage.js +17 -0
  7. package/dist/cjs/youtube/{Transcript/proto → Caption}/index.js +2 -1
  8. package/dist/cjs/youtube/Client/Client.js +9 -13
  9. package/dist/cjs/youtube/Comment/CommentParser.js +11 -12
  10. package/dist/cjs/youtube/LiveVideo/LiveVideo.js +15 -15
  11. package/dist/cjs/youtube/Video/Video.js +4 -6
  12. package/dist/cjs/youtube/Video/VideoParser.js +3 -3
  13. package/dist/cjs/youtube/VideoCompact/VideoCompact.js +2 -2
  14. package/dist/cjs/youtube/VideoCompact/VideoCompactParser.js +4 -2
  15. package/dist/cjs/youtube/index.js +0 -1
  16. package/dist/esm/common/shared/HTTP/HTTP.js +59 -12
  17. package/dist/esm/youtube/BaseVideo/BaseVideoParser.js +7 -2
  18. package/dist/esm/youtube/BaseVideo/VideoCaptions.js +133 -0
  19. package/dist/esm/youtube/BaseVideo/index.js +1 -0
  20. package/dist/esm/youtube/Caption/Caption.js +19 -0
  21. package/dist/esm/youtube/Caption/CaptionLanguage.js +15 -0
  22. package/dist/esm/youtube/Caption/index.js +2 -0
  23. package/dist/esm/youtube/Client/Client.js +13 -18
  24. package/dist/esm/youtube/Comment/CommentParser.js +11 -12
  25. package/dist/esm/youtube/LiveVideo/LiveVideo.js +15 -15
  26. package/dist/esm/youtube/Video/Video.js +5 -7
  27. package/dist/esm/youtube/Video/VideoParser.js +4 -4
  28. package/dist/esm/youtube/VideoCompact/VideoCompact.js +2 -2
  29. package/dist/esm/youtube/VideoCompact/VideoCompactParser.js +4 -2
  30. package/dist/esm/youtube/index.js +0 -1
  31. package/dist/typings/common/shared/HTTP/HTTP.d.ts +2 -2
  32. package/dist/typings/youtube/BaseVideo/BaseVideo.d.ts +3 -0
  33. package/dist/typings/youtube/BaseVideo/VideoCaptions.d.ts +40 -0
  34. package/dist/typings/youtube/BaseVideo/index.d.ts +1 -0
  35. package/dist/typings/youtube/Caption/Caption.d.ts +22 -0
  36. package/dist/typings/youtube/Caption/CaptionLanguage.d.ts +30 -0
  37. package/dist/typings/youtube/Caption/index.d.ts +2 -0
  38. package/dist/typings/youtube/Client/Client.d.ts +8 -3
  39. package/dist/typings/youtube/LiveVideo/LiveVideo.d.ts +5 -5
  40. package/dist/typings/youtube/Video/Video.d.ts +3 -6
  41. package/dist/typings/youtube/VideoCompact/VideoCompact.d.ts +2 -2
  42. package/dist/typings/youtube/index.d.ts +0 -1
  43. package/package.json +1 -1
  44. package/dist/cjs/youtube/Transcript/Transcript.js +0 -27
  45. package/dist/cjs/youtube/Transcript/TranscriptParser.js +0 -13
  46. package/dist/cjs/youtube/Transcript/index.js +0 -15
  47. package/dist/cjs/youtube/Transcript/proto/TranscriptParamsProto.js +0 -12
  48. package/dist/esm/youtube/Transcript/Transcript.js +0 -29
  49. package/dist/esm/youtube/Transcript/TranscriptParser.js +0 -13
  50. package/dist/esm/youtube/Transcript/index.js +0 -3
  51. package/dist/esm/youtube/Transcript/proto/TranscriptParamsProto.js +0 -2
  52. package/dist/esm/youtube/Transcript/proto/index.js +0 -1
  53. package/dist/typings/youtube/Transcript/Transcript.d.ts +0 -29
  54. package/dist/typings/youtube/Transcript/TranscriptParser.d.ts +0 -5
  55. package/dist/typings/youtube/Transcript/index.d.ts +0 -3
  56. package/dist/typings/youtube/Transcript/proto/TranscriptParamsProto.d.ts +0 -7
  57. package/dist/typings/youtube/Transcript/proto/index.d.ts +0 -1
@@ -1,8 +1,8 @@
1
1
  import { Thumbnails, YoutubeRawData } from "../../common";
2
2
  import { Base, BaseProperties } from "../Base";
3
3
  import { BaseChannel } from "../BaseChannel";
4
+ import { Caption } from "../Caption";
4
5
  import { LiveVideo } from "../LiveVideo";
5
- import { Transcript } from "../Transcript";
6
6
  import { Video } from "../Video";
7
7
  /** @hidden */
8
8
  interface VideoCompactProperties extends BaseProperties {
@@ -61,6 +61,6 @@ export declare class VideoCompact extends Base implements VideoCompactProperties
61
61
  * client.getVideoTranscript(video.id);
62
62
  * ```
63
63
  */
64
- getTranscript(): Promise<Transcript[] | undefined>;
64
+ getTranscript(languageCode?: string): Promise<Caption[] | undefined>;
65
65
  }
66
66
  export {};
@@ -12,6 +12,5 @@ export * from "./Playlist";
12
12
  export * from "./PlaylistCompact";
13
13
  export * from "./Reply";
14
14
  export * from "./SearchResult";
15
- export * from "./Transcript";
16
15
  export * from "./Video";
17
16
  export * from "./VideoCompact";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "youtubei",
3
- "version": "1.3.7",
3
+ "version": "1.4.0",
4
4
  "description": "Simple package to get information from youtube such as videos, playlists, channels, video information & comments, related videos, up next video, and more!",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Transcript = void 0;
4
- const TranscriptParser_1 = require("./TranscriptParser");
5
- /**
6
- * Represent a single video transcript entry
7
- */
8
- class Transcript {
9
- /** @hidden */
10
- constructor(attr) {
11
- Object.assign(this, attr);
12
- }
13
- /** transcript end time in miliseconds */
14
- get end() {
15
- return this.start + this.duration;
16
- }
17
- /**
18
- * Load this instance with raw data from Youtube
19
- *
20
- * @hidden
21
- */
22
- load(data) {
23
- TranscriptParser_1.TranscriptParser.loadTranscript(this, data);
24
- return this;
25
- }
26
- }
27
- exports.Transcript = Transcript;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TranscriptParser = void 0;
4
- class TranscriptParser {
5
- static loadTranscript(target, data) {
6
- const { cue, startOffsetMs, durationMs } = data;
7
- target.text = cue.simpleText;
8
- target.duration = +durationMs;
9
- target.start = +startOffsetMs;
10
- return target;
11
- }
12
- }
13
- exports.TranscriptParser = TranscriptParser;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./proto"), exports);
14
- __exportStar(require("./Transcript"), exports);
15
- __exportStar(require("./TranscriptParser"), exports);
@@ -1,12 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TranscriptParamsProto = void 0;
7
- const protobufjs_1 = __importDefault(require("protobufjs"));
8
- exports.TranscriptParamsProto = protobufjs_1.default.parse(`
9
- message TranscriptParams {
10
- optional string videoId = 1;
11
- }
12
- `).root.lookupType("TranscriptParams");
@@ -1,29 +0,0 @@
1
- import { TranscriptParser } from "./TranscriptParser";
2
- /**
3
- * Represent a single video transcript entry
4
- */
5
- var Transcript = /** @class */ (function () {
6
- /** @hidden */
7
- function Transcript(attr) {
8
- Object.assign(this, attr);
9
- }
10
- Object.defineProperty(Transcript.prototype, "end", {
11
- /** transcript end time in miliseconds */
12
- get: function () {
13
- return this.start + this.duration;
14
- },
15
- enumerable: false,
16
- configurable: true
17
- });
18
- /**
19
- * Load this instance with raw data from Youtube
20
- *
21
- * @hidden
22
- */
23
- Transcript.prototype.load = function (data) {
24
- TranscriptParser.loadTranscript(this, data);
25
- return this;
26
- };
27
- return Transcript;
28
- }());
29
- export { Transcript };
@@ -1,13 +0,0 @@
1
- var TranscriptParser = /** @class */ (function () {
2
- function TranscriptParser() {
3
- }
4
- TranscriptParser.loadTranscript = function (target, data) {
5
- var cue = data.cue, startOffsetMs = data.startOffsetMs, durationMs = data.durationMs;
6
- target.text = cue.simpleText;
7
- target.duration = +durationMs;
8
- target.start = +startOffsetMs;
9
- return target;
10
- };
11
- return TranscriptParser;
12
- }());
13
- export { TranscriptParser };
@@ -1,3 +0,0 @@
1
- export * from "./proto";
2
- export * from "./Transcript";
3
- export * from "./TranscriptParser";
@@ -1,2 +0,0 @@
1
- import protobuf from "protobufjs";
2
- export var TranscriptParamsProto = protobuf.parse("\n\tmessage TranscriptParams {\n\t\toptional string videoId = 1;\n\t}\n").root.lookupType("TranscriptParams");
@@ -1 +0,0 @@
1
- export * from "./TranscriptParamsProto";
@@ -1,29 +0,0 @@
1
- import { YoutubeRawData } from "../../common";
2
- /** @hidden */
3
- interface TranscriptProperties {
4
- text?: string;
5
- start?: number;
6
- duration?: number;
7
- }
8
- /**
9
- * Represent a single video transcript entry
10
- */
11
- export declare class Transcript implements TranscriptProperties {
12
- /** transcript content */
13
- text: string;
14
- /** transcript start time in miliseconds */
15
- start: number;
16
- /** transcript duration in miliseconds */
17
- duration: number;
18
- /** @hidden */
19
- constructor(attr?: TranscriptProperties);
20
- /** transcript end time in miliseconds */
21
- get end(): number;
22
- /**
23
- * Load this instance with raw data from Youtube
24
- *
25
- * @hidden
26
- */
27
- load(data: YoutubeRawData): Transcript;
28
- }
29
- export {};
@@ -1,5 +0,0 @@
1
- import { YoutubeRawData } from "../../common";
2
- import { Transcript } from "./Transcript";
3
- export declare class TranscriptParser {
4
- static loadTranscript(target: Transcript, data: YoutubeRawData): Transcript;
5
- }
@@ -1,3 +0,0 @@
1
- export * from "./proto";
2
- export * from "./Transcript";
3
- export * from "./TranscriptParser";
@@ -1,7 +0,0 @@
1
- import protobuf from "protobufjs";
2
- export declare type TranscriptParams = {
3
- TranscriptParams: {
4
- videoId: string;
5
- };
6
- };
7
- export declare const TranscriptParamsProto: protobuf.Type;
@@ -1 +0,0 @@
1
- export * from "./TranscriptParamsProto";