youtubei 0.0.1-rc.32 → 0.0.1-rc.35
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.
|
@@ -11,7 +11,6 @@ export interface BaseVideoAttributes extends BaseAttributes {
|
|
|
11
11
|
likeCount: number | null;
|
|
12
12
|
isLiveContent: boolean;
|
|
13
13
|
tags: string[];
|
|
14
|
-
upNext: VideoCompact | PlaylistCompact | null;
|
|
15
14
|
related: (VideoCompact | PlaylistCompact)[];
|
|
16
15
|
relatedContinuation?: string;
|
|
17
16
|
}
|
|
@@ -35,8 +34,6 @@ export default class BaseVideo extends Base implements BaseVideoAttributes {
|
|
|
35
34
|
isLiveContent: boolean;
|
|
36
35
|
/** The tags of this video */
|
|
37
36
|
tags: string[];
|
|
38
|
-
/** Next video / playlist recommended by Youtube */
|
|
39
|
-
upNext: VideoCompact | PlaylistCompact | null;
|
|
40
37
|
/** Videos / playlists related to this video */
|
|
41
38
|
related: (VideoCompact | PlaylistCompact)[];
|
|
42
39
|
/** Current continuation token to load next related content */
|
|
@@ -49,6 +46,13 @@ export default class BaseVideo extends Base implements BaseVideoAttributes {
|
|
|
49
46
|
* @hidden
|
|
50
47
|
*/
|
|
51
48
|
load(data: YoutubeRawData): BaseVideo;
|
|
49
|
+
/**
|
|
50
|
+
* Video / playlist to play next after this video, alias to
|
|
51
|
+
* ```js
|
|
52
|
+
* video.related[0]
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
get upNext(): VideoCompact | PlaylistCompact;
|
|
52
56
|
/** Load next related videos / playlists */
|
|
53
57
|
nextRelated(count?: number): Promise<(VideoCompact | PlaylistCompact)[]>;
|
|
54
58
|
/** @hidden */
|
|
@@ -27,7 +27,7 @@ class BaseVideo extends _1.Base {
|
|
|
27
27
|
* @hidden
|
|
28
28
|
*/
|
|
29
29
|
load(data) {
|
|
30
|
-
var _a, _b, _c
|
|
30
|
+
var _a, _b, _c;
|
|
31
31
|
const videoInfo = BaseVideo.parseRawData(data);
|
|
32
32
|
// Basic information
|
|
33
33
|
this.id = videoInfo.videoDetails.videoId;
|
|
@@ -58,18 +58,24 @@ class BaseVideo extends _1.Base {
|
|
|
58
58
|
const secondaryContents = data[3].response.contents.twoColumnWatchNextResults.secondaryResults.secondaryResults
|
|
59
59
|
.results;
|
|
60
60
|
if (secondaryContents) {
|
|
61
|
-
const upNext = ((_d = secondaryContents.find((s) => "compactAutoplayRenderer" in s)) === null || _d === void 0 ? void 0 : _d.compactAutoplayRenderer.contents[0]) || null;
|
|
62
|
-
this.upNext = upNext ? BaseVideo.parseCompactRenderer(upNext, this.client) : upNext;
|
|
63
61
|
this.related.push(...BaseVideo.parseRelated(secondaryContents, this.client));
|
|
64
62
|
// Related continuation
|
|
65
63
|
this.relatedContinuation = common_1.getContinuationFromItems(secondaryContents);
|
|
66
64
|
}
|
|
67
65
|
else {
|
|
68
|
-
this.upNext = null;
|
|
69
66
|
this.related = [];
|
|
70
67
|
}
|
|
71
68
|
return this;
|
|
72
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Video / playlist to play next after this video, alias to
|
|
72
|
+
* ```js
|
|
73
|
+
* video.related[0]
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
get upNext() {
|
|
77
|
+
return this.related[0];
|
|
78
|
+
}
|
|
73
79
|
/** Load next related videos / playlists */
|
|
74
80
|
nextRelated(count = 1) {
|
|
75
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7,7 +7,7 @@ interface PlaylistCompactAttributes extends BaseAttributes {
|
|
|
7
7
|
channel?: ChannelCompact;
|
|
8
8
|
videoCount: number;
|
|
9
9
|
}
|
|
10
|
-
/** Represents a Compact Playlist (e.g. from search result,
|
|
10
|
+
/** Represents a Compact Playlist (e.g. from search result, related of a video) */
|
|
11
11
|
export default class PlaylistCompact extends Base implements PlaylistCompactAttributes {
|
|
12
12
|
/** The playlist's title */
|
|
13
13
|
title: string;
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const _1 = require(".");
|
|
13
13
|
const common_1 = require("../common");
|
|
14
|
-
/** Represents a Compact Playlist (e.g. from search result,
|
|
14
|
+
/** Represents a Compact Playlist (e.g. from search result, related of a video) */
|
|
15
15
|
class PlaylistCompact extends _1.Base {
|
|
16
16
|
/** @hidden */
|
|
17
17
|
constructor(playlist = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "youtubei",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.35",
|
|
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/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|