youtubei 1.7.0 → 1.8.1
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.
- package/dist/cjs/music/MusicClient/MusicClient.js +13 -18
- package/dist/cjs/music/MusicSearchResult/MusicSearchResult.js +8 -4
- package/dist/cjs/music/MusicSearchResult/MusicSearchResultParser.js +214 -13
- package/dist/cjs/music/MusicSearchResult/index.js +0 -1
- package/dist/cjs/youtube/BaseChannel/BaseChannel.js +2 -0
- package/dist/cjs/youtube/BaseChannel/BaseChannelParser.js +3 -2
- package/dist/cjs/youtube/BaseChannel/ChannelPlaylists.js +12 -2
- package/dist/cjs/youtube/BaseChannel/ChannelPosts.js +59 -0
- package/dist/cjs/youtube/BaseVideo/BaseVideoParser.js +1 -1
- package/dist/cjs/youtube/Channel/ChannelParser.js +10 -6
- package/dist/cjs/youtube/PlaylistCompact/PlaylistCompactParser.js +3 -3
- package/dist/cjs/youtube/Post/Post.js +23 -0
- package/dist/cjs/youtube/Post/PostParser.js +23 -0
- package/dist/cjs/youtube/Post/index.js +14 -0
- package/dist/esm/music/MusicClient/MusicClient.js +16 -20
- package/dist/esm/music/MusicSearchResult/MusicSearchResult.js +7 -4
- package/dist/esm/music/MusicSearchResult/MusicSearchResultParser.js +231 -13
- package/dist/esm/music/MusicSearchResult/index.js +0 -1
- package/dist/esm/youtube/BaseChannel/BaseChannel.js +2 -0
- package/dist/esm/youtube/BaseChannel/BaseChannelParser.js +3 -2
- package/dist/esm/youtube/BaseChannel/ChannelPlaylists.js +11 -3
- package/dist/esm/youtube/BaseChannel/ChannelPosts.js +111 -0
- package/dist/esm/youtube/BaseVideo/BaseVideoParser.js +1 -1
- package/dist/esm/youtube/Channel/ChannelParser.js +12 -8
- package/dist/esm/youtube/PlaylistCompact/PlaylistCompactParser.js +3 -3
- package/dist/esm/youtube/Post/Post.js +36 -0
- package/dist/esm/youtube/Post/PostParser.js +23 -0
- package/dist/esm/youtube/Post/index.js +2 -0
- package/dist/typings/music/MusicClient/MusicClient.d.ts +3 -7
- package/dist/typings/music/MusicSearchResult/MusicSearchResult.d.ts +11 -4
- package/dist/typings/music/MusicSearchResult/MusicSearchResultParser.d.ts +18 -3
- package/dist/typings/music/MusicSearchResult/index.d.ts +0 -1
- package/dist/typings/youtube/BaseChannel/BaseChannel.d.ts +4 -1
- package/dist/typings/youtube/BaseChannel/BaseChannelParser.d.ts +1 -0
- package/dist/typings/youtube/BaseChannel/ChannelPosts.d.ts +30 -0
- package/dist/typings/youtube/Post/Post.d.ts +32 -0
- package/dist/typings/youtube/Post/PostParser.d.ts +5 -0
- package/dist/typings/youtube/Post/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/music/MusicSearchResult/MusicAllSearchResultParser.js +0 -218
- package/dist/esm/music/MusicSearchResult/MusicAllSearchResultParser.js +0 -234
- package/dist/typings/music/MusicSearchResult/MusicAllSearchResultParser.d.ts +0 -19
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { HTTP } from "../../common";
|
|
49
49
|
import { MusicLyrics } from "../MusicLyrics";
|
|
50
|
-
import {
|
|
50
|
+
import { MusicSearchResult } from "../MusicSearchResult";
|
|
51
51
|
import { BASE_URL, INNERTUBE_API_KEY, INNERTUBE_CLIENT_NAME, INNERTUBE_CLIENT_VERSION, I_END_POINT, } from "../constants";
|
|
52
52
|
/** Youtube Music Client */
|
|
53
53
|
var MusicClient = /** @class */ (function () {
|
|
@@ -56,23 +56,22 @@ var MusicClient = /** @class */ (function () {
|
|
|
56
56
|
var fullOptions = __assign(__assign({ initialCookie: "", oauth: { enabled: false }, fetchOptions: {} }, options), { youtubeClientOptions: __assign({ hl: "en", gl: "US" }, options.youtubeClientOptions), apiKey: options.apiKey || INNERTUBE_API_KEY, baseUrl: options.baseUrl || BASE_URL, clientName: options.clientName || INNERTUBE_CLIENT_NAME, clientVersion: options.clientVersion || INNERTUBE_CLIENT_VERSION });
|
|
57
57
|
this.http = new HTTP(fullOptions);
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Searches for video, song, album, playlist, or artist
|
|
61
|
+
*
|
|
62
|
+
* @param query The search query
|
|
63
|
+
* @param type Search type
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
59
66
|
MusicClient.prototype.search = function (query, type) {
|
|
60
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var
|
|
68
|
+
var result;
|
|
62
69
|
return __generator(this, function (_a) {
|
|
63
70
|
switch (_a.label) {
|
|
64
71
|
case 0:
|
|
65
|
-
if (!!type) return [3 /*break*/, 2];
|
|
66
|
-
return [4 /*yield*/, this.http.post(I_END_POINT + "/search", {
|
|
67
|
-
data: { query: query },
|
|
68
|
-
})];
|
|
69
|
-
case 1:
|
|
70
|
-
response = _a.sent();
|
|
71
|
-
return [2 /*return*/, MusicAllSearchResultParser.parseSearchResult(response.data, this)];
|
|
72
|
-
case 2:
|
|
73
72
|
result = new MusicSearchResult({ client: this });
|
|
74
73
|
return [4 /*yield*/, result.search(query, type)];
|
|
75
|
-
case
|
|
74
|
+
case 1:
|
|
76
75
|
_a.sent();
|
|
77
76
|
return [2 /*return*/, result];
|
|
78
77
|
}
|
|
@@ -86,18 +85,15 @@ var MusicClient = /** @class */ (function () {
|
|
|
86
85
|
*/
|
|
87
86
|
MusicClient.prototype.searchAll = function (query) {
|
|
88
87
|
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
var
|
|
88
|
+
var result;
|
|
90
89
|
return __generator(this, function (_a) {
|
|
91
90
|
switch (_a.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
case 0:
|
|
92
|
+
result = new MusicSearchResult({ client: this });
|
|
93
|
+
return [4 /*yield*/, result.search(query)];
|
|
95
94
|
case 1:
|
|
96
|
-
|
|
97
|
-
return [2 /*return*/,
|
|
98
|
-
top: MusicAllSearchResultParser.parseTopResult(response.data, this),
|
|
99
|
-
shelves: MusicAllSearchResultParser.parseSearchResult(response.data, this),
|
|
100
|
-
}];
|
|
95
|
+
_a.sent();
|
|
96
|
+
return [2 /*return*/, result];
|
|
101
97
|
}
|
|
102
98
|
});
|
|
103
99
|
});
|
|
@@ -104,6 +104,7 @@ var MusicSearchResult = /** @class */ (function (_super) {
|
|
|
104
104
|
function MusicSearchResult(_a) {
|
|
105
105
|
var client = _a.client, type = _a.type;
|
|
106
106
|
var _this = _super.call(this, { client: client }) || this;
|
|
107
|
+
_this.top = null;
|
|
107
108
|
if (type)
|
|
108
109
|
_this.type = type;
|
|
109
110
|
return _this;
|
|
@@ -125,16 +126,18 @@ var MusicSearchResult = /** @class */ (function (_super) {
|
|
|
125
126
|
case 0:
|
|
126
127
|
this.items = [];
|
|
127
128
|
this.type = type;
|
|
128
|
-
|
|
129
|
+
if (type)
|
|
130
|
+
bufferParams = MusicSearchProto.encode(optionsToProto(type)).finish();
|
|
129
131
|
return [4 /*yield*/, this.client.http.post(I_END_POINT + "/search", {
|
|
130
132
|
data: {
|
|
131
133
|
query: query,
|
|
132
|
-
params: Buffer.from(bufferParams).toString("base64"),
|
|
134
|
+
params: bufferParams ? Buffer.from(bufferParams).toString("base64") : undefined,
|
|
133
135
|
},
|
|
134
136
|
})];
|
|
135
137
|
case 1:
|
|
136
138
|
response = _c.sent();
|
|
137
|
-
_a = MusicSearchResultParser.parseInitialSearchResult(response.data,
|
|
139
|
+
_a = MusicSearchResultParser.parseInitialSearchResult(response.data, this.client), data = _a.data, continuation = _a.continuation;
|
|
140
|
+
this.top = MusicSearchResultParser.parseTopResult(response.data, this.client) || null;
|
|
138
141
|
(_b = this.items).push.apply(_b, __spread(data));
|
|
139
142
|
this.continuation = continuation;
|
|
140
143
|
return [2 /*return*/, this];
|
|
@@ -159,7 +162,7 @@ var MusicSearchResult = /** @class */ (function (_super) {
|
|
|
159
162
|
})];
|
|
160
163
|
case 1:
|
|
161
164
|
response = _b.sent();
|
|
162
|
-
_a = MusicSearchResultParser.parseContinuationSearchResult(response.data, this.
|
|
165
|
+
_a = MusicSearchResultParser.parseContinuationSearchResult(response.data, this.client), data = _a.data, continuation = _a.continuation;
|
|
163
166
|
return [2 /*return*/, {
|
|
164
167
|
items: data,
|
|
165
168
|
continuation: continuation,
|
|
@@ -9,43 +9,141 @@ var __values = (this && this.__values) || function(o) {
|
|
|
9
9
|
};
|
|
10
10
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
import { getDuration, stripToInt, Thumbnails } from "../../common";
|
|
29
|
+
import { MusicAlbumCompact } from "../MusicAlbumCompact";
|
|
30
|
+
import { MusicArtistCompact } from "../MusicArtistCompact";
|
|
31
|
+
import { MusicBaseArtist } from "../MusicBaseArtist";
|
|
32
|
+
import { MusicBaseChannel } from "../MusicBaseChannel";
|
|
33
|
+
import { MusicPlaylistCompact } from "../MusicPlaylistCompact";
|
|
34
|
+
import { MusicSongCompact } from "../MusicSongCompact";
|
|
35
|
+
import { MusicVideoCompact } from "../MusicVideoCompact";
|
|
13
36
|
var MusicSearchResultParser = /** @class */ (function () {
|
|
14
37
|
function MusicSearchResultParser() {
|
|
15
38
|
}
|
|
16
|
-
MusicSearchResultParser.parseInitialSearchResult = function (data,
|
|
39
|
+
MusicSearchResultParser.parseInitialSearchResult = function (data, client) {
|
|
17
40
|
var _a, _b;
|
|
18
|
-
var
|
|
19
|
-
|
|
41
|
+
var sectionContents = data.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content
|
|
42
|
+
.sectionListRenderer.contents;
|
|
43
|
+
var resultContents = sectionContents.find(function (c) { return "musicShelfRenderer" in c; });
|
|
44
|
+
if (!resultContents) {
|
|
20
45
|
// no results
|
|
21
46
|
return {
|
|
22
47
|
data: [],
|
|
23
48
|
continuation: undefined,
|
|
24
49
|
};
|
|
25
50
|
}
|
|
26
|
-
var _c =
|
|
51
|
+
var _c = resultContents.musicShelfRenderer, contents = _c.contents, continuations = _c.continuations;
|
|
52
|
+
var result = MusicSearchResultParser.parseSearchResult(contents, client);
|
|
27
53
|
return {
|
|
28
|
-
data:
|
|
54
|
+
data: result,
|
|
29
55
|
continuation: (_b = (_a = continuations === null || continuations === void 0 ? void 0 : continuations[0]) === null || _a === void 0 ? void 0 : _a.nextContinuationData) === null || _b === void 0 ? void 0 : _b.continuation,
|
|
30
56
|
};
|
|
31
57
|
};
|
|
32
|
-
MusicSearchResultParser.parseContinuationSearchResult = function (data,
|
|
58
|
+
MusicSearchResultParser.parseContinuationSearchResult = function (data, client) {
|
|
33
59
|
var shelf = data.continuationContents.musicShelfContinuation;
|
|
34
60
|
return {
|
|
35
|
-
data: MusicSearchResultParser.parseSearchResult(shelf.contents,
|
|
61
|
+
data: MusicSearchResultParser.parseSearchResult(shelf.contents, client),
|
|
36
62
|
continuation: shelf.continuations[0].nextContinuationData.continuation,
|
|
37
63
|
};
|
|
38
64
|
};
|
|
39
|
-
MusicSearchResultParser.
|
|
65
|
+
MusicSearchResultParser.parseTopResult = function (data, client) {
|
|
66
|
+
var _this = this;
|
|
67
|
+
var sectionContents = data.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content
|
|
68
|
+
.sectionListRenderer.contents;
|
|
69
|
+
var topContent = sectionContents.find(function (c) { return "musicCardShelfRenderer" in c; });
|
|
70
|
+
var top = topContent === null || topContent === void 0 ? void 0 : topContent.musicCardShelfRenderer;
|
|
71
|
+
if (!top)
|
|
72
|
+
return null;
|
|
73
|
+
var _a = top.title.runs[0].navigationEndpoint, browseEndpoint = _a.browseEndpoint, watchEndpoint = _a.watchEndpoint;
|
|
74
|
+
var id = (watchEndpoint === null || watchEndpoint === void 0 ? void 0 : watchEndpoint.videoId) || (browseEndpoint === null || browseEndpoint === void 0 ? void 0 : browseEndpoint.browseId);
|
|
75
|
+
var type = (watchEndpoint === null || watchEndpoint === void 0 ? void 0 : watchEndpoint.watchEndpointMusicSupportedConfigs.watchEndpointMusicConfig.musicVideoType) || (browseEndpoint === null || browseEndpoint === void 0 ? void 0 : browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType);
|
|
76
|
+
var title = top.title.runs[0].text;
|
|
77
|
+
var thumbnail = top.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails;
|
|
78
|
+
var topResult;
|
|
79
|
+
if (type === "MUSIC_VIDEO_TYPE_ATV") {
|
|
80
|
+
topResult = new MusicSongCompact({
|
|
81
|
+
client: client,
|
|
82
|
+
id: id,
|
|
83
|
+
title: title,
|
|
84
|
+
duration: getDuration(top.subtitle.runs.at(-1).text),
|
|
85
|
+
artists: this.parseArtists(top.subtitle.runs, client),
|
|
86
|
+
album: this.parseAlbum(top.subtitle.runs, client),
|
|
87
|
+
thumbnails: new Thumbnails().load(thumbnail),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else if (type === "MUSIC_VIDEO_TYPE_UGC" || type === "MUSIC_VIDEO_TYPE_OMV") {
|
|
91
|
+
topResult = new MusicVideoCompact({
|
|
92
|
+
client: client,
|
|
93
|
+
id: id,
|
|
94
|
+
title: title,
|
|
95
|
+
duration: getDuration(top.subtitle.runs.at(-1).text),
|
|
96
|
+
artists: this.parseArtists(top.subtitle.runs, client),
|
|
97
|
+
thumbnails: new Thumbnails().load(thumbnail),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else if (type === "MUSIC_PAGE_TYPE_ALBUM") {
|
|
101
|
+
topResult = new MusicAlbumCompact({
|
|
102
|
+
client: client,
|
|
103
|
+
id: id,
|
|
104
|
+
title: title,
|
|
105
|
+
artists: this.parseArtists(top.subtitle.runs, client),
|
|
106
|
+
thumbnails: new Thumbnails().load(thumbnail),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else if (type === "MUSIC_PAGE_TYPE_ARTIST") {
|
|
110
|
+
topResult = new MusicArtistCompact({
|
|
111
|
+
client: client,
|
|
112
|
+
id: id,
|
|
113
|
+
name: title,
|
|
114
|
+
thumbnails: new Thumbnails().load(thumbnail),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else if (type === "MUSIC_PAGE_TYPE_PLAYLIST") {
|
|
118
|
+
topResult = new MusicPlaylistCompact({
|
|
119
|
+
client: client,
|
|
120
|
+
id: id,
|
|
121
|
+
title: title,
|
|
122
|
+
channel: this.parseChannel(top.subtitle.runs, client),
|
|
123
|
+
thumbnails: new Thumbnails().load(thumbnail),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (!topResult)
|
|
127
|
+
return null;
|
|
128
|
+
var more = [];
|
|
129
|
+
if (top.contents) {
|
|
130
|
+
more = top.contents
|
|
131
|
+
.filter(function (c) { return c.musicResponsiveListItemRenderer; })
|
|
132
|
+
.map(function (c) { return _this.parseSearchItem(c, client); });
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
item: topResult,
|
|
136
|
+
more: more,
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
MusicSearchResultParser.parseSearchResult = function (shelfContents, client) {
|
|
40
140
|
var e_1, _a;
|
|
41
|
-
var rawContents = shelfContents
|
|
42
|
-
.filter(function (c) { return "musicResponsiveListItemRenderer" in c; })
|
|
43
|
-
.map(function (c) { return c.musicResponsiveListItemRenderer; });
|
|
141
|
+
var rawContents = shelfContents.filter(function (c) { return "musicResponsiveListItemRenderer" in c; });
|
|
44
142
|
var contents = [];
|
|
45
143
|
try {
|
|
46
144
|
for (var rawContents_1 = __values(rawContents), rawContents_1_1 = rawContents_1.next(); !rawContents_1_1.done; rawContents_1_1 = rawContents_1.next()) {
|
|
47
145
|
var c = rawContents_1_1.value;
|
|
48
|
-
var parsed =
|
|
146
|
+
var parsed = this.parseSearchItem(c, client);
|
|
49
147
|
if (parsed)
|
|
50
148
|
contents.push(parsed);
|
|
51
149
|
}
|
|
@@ -59,6 +157,126 @@ var MusicSearchResultParser = /** @class */ (function () {
|
|
|
59
157
|
}
|
|
60
158
|
return contents;
|
|
61
159
|
};
|
|
160
|
+
MusicSearchResultParser.parseSearchItem = function (content, client) {
|
|
161
|
+
var _a;
|
|
162
|
+
var item = content.musicResponsiveListItemRenderer;
|
|
163
|
+
var playEndpoint = (_a = item.overlay) === null || _a === void 0 ? void 0 : _a.musicItemThumbnailOverlayRenderer.content.musicPlayButtonRenderer.playNavigationEndpoint;
|
|
164
|
+
if (playEndpoint === null || playEndpoint === void 0 ? void 0 : playEndpoint.watchEndpoint) {
|
|
165
|
+
var pageType = playEndpoint.watchEndpoint.watchEndpointMusicSupportedConfigs
|
|
166
|
+
.watchEndpointMusicConfig.musicVideoType;
|
|
167
|
+
return this.parseVideoItem(item, pageType, client);
|
|
168
|
+
}
|
|
169
|
+
else if (playEndpoint === null || playEndpoint === void 0 ? void 0 : playEndpoint.watchPlaylistEndpoint.params) {
|
|
170
|
+
return this.parsePlaylistItem(item, client);
|
|
171
|
+
}
|
|
172
|
+
else if (playEndpoint === null || playEndpoint === void 0 ? void 0 : playEndpoint.watchPlaylistEndpoint) {
|
|
173
|
+
// TODO add podcast support, id starts with PL
|
|
174
|
+
if (playEndpoint.watchPlaylistEndpoint.playlistId.startsWith("OL")) {
|
|
175
|
+
return this.parseAlbumItem(item, client);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
return this.parseArtistItem(item, client);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
MusicSearchResultParser.parseVideoItem = function (item, pageType, client) {
|
|
183
|
+
// TODO support other types
|
|
184
|
+
if (!["MUSIC_VIDEO_TYPE_ATV", "MUSIC_VIDEO_TYPE_UGC", "MUSIC_VIDEO_TYPE_OMV"].includes(pageType)) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
var _a = __read(item.flexColumns.map(function (c) { return c.musicResponsiveListItemFlexColumnRenderer.text.runs; }), 2), topColumn = _a[0], bottomColumn = _a[1];
|
|
188
|
+
var id = topColumn[0].navigationEndpoint.watchEndpoint.videoId;
|
|
189
|
+
var title = topColumn[0].text;
|
|
190
|
+
var duration = getDuration(bottomColumn.at(-1).text) || undefined;
|
|
191
|
+
var thumbnails = new Thumbnails().load(item.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails);
|
|
192
|
+
var artists = this.parseArtists(bottomColumn, client);
|
|
193
|
+
if (pageType === "MUSIC_VIDEO_TYPE_ATV") {
|
|
194
|
+
return new MusicSongCompact({
|
|
195
|
+
client: client,
|
|
196
|
+
id: id,
|
|
197
|
+
album: this.parseAlbum(bottomColumn, client),
|
|
198
|
+
title: title,
|
|
199
|
+
artists: artists,
|
|
200
|
+
thumbnails: thumbnails,
|
|
201
|
+
duration: duration,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
else if (pageType === "MUSIC_VIDEO_TYPE_UGC" || pageType === "MUSIC_VIDEO_TYPE_OMV") {
|
|
205
|
+
return new MusicVideoCompact({ client: client, id: id, title: title, artists: artists, thumbnails: thumbnails, duration: duration });
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
MusicSearchResultParser.parsePlaylistItem = function (item, client) {
|
|
209
|
+
var _a = __read(item.flexColumns.map(function (c) { return c.musicResponsiveListItemFlexColumnRenderer.text.runs; }), 2), topColumn = _a[0], bottomColumn = _a[1];
|
|
210
|
+
var id = item.overlay.musicItemThumbnailOverlayRenderer.content.musicPlayButtonRenderer
|
|
211
|
+
.playNavigationEndpoint.watchPlaylistEndpoint.playlistId;
|
|
212
|
+
var title = topColumn[0].text;
|
|
213
|
+
var songCount = stripToInt(bottomColumn.at(-1).text) || undefined;
|
|
214
|
+
var thumbnails = new Thumbnails().load(item.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails);
|
|
215
|
+
var channel = this.parseChannel(bottomColumn, client);
|
|
216
|
+
return new MusicPlaylistCompact({ client: client, id: id, title: title, thumbnails: thumbnails, songCount: songCount, channel: channel });
|
|
217
|
+
};
|
|
218
|
+
MusicSearchResultParser.parseAlbumItem = function (item, client) {
|
|
219
|
+
var _a = __read(item.flexColumns.map(function (c) { return c.musicResponsiveListItemFlexColumnRenderer.text.runs; }), 2), topColumn = _a[0], bottomColumn = _a[1];
|
|
220
|
+
var id = item.overlay.musicItemThumbnailOverlayRenderer.content.musicPlayButtonRenderer
|
|
221
|
+
.playNavigationEndpoint.watchPlaylistEndpoint.playlistId;
|
|
222
|
+
var title = topColumn[0].text;
|
|
223
|
+
var year = stripToInt(bottomColumn.at(-1).text) || undefined;
|
|
224
|
+
var thumbnails = new Thumbnails().load(item.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails);
|
|
225
|
+
var artists = this.parseArtists(bottomColumn, client);
|
|
226
|
+
return new MusicAlbumCompact({ client: client, id: id, title: title, thumbnails: thumbnails, artists: artists, year: year });
|
|
227
|
+
};
|
|
228
|
+
MusicSearchResultParser.parseArtistItem = function (item, client) {
|
|
229
|
+
var _a = __read(item.flexColumns.map(function (c) { return c.musicResponsiveListItemFlexColumnRenderer.text.runs; }), 1), topColumn = _a[0];
|
|
230
|
+
var id = item.navigationEndpoint.browseEndpoint.browseId;
|
|
231
|
+
var name = topColumn[0].text;
|
|
232
|
+
var thumbnails = new Thumbnails().load(item.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails);
|
|
233
|
+
return new MusicArtistCompact({ client: client, id: id, name: name, thumbnails: thumbnails });
|
|
234
|
+
};
|
|
235
|
+
MusicSearchResultParser.parseAlbum = function (items, client) {
|
|
236
|
+
var _a;
|
|
237
|
+
var albumRaw = items.find(function (r) {
|
|
238
|
+
var _a;
|
|
239
|
+
var pageType = (_a = r.navigationEndpoint) === null || _a === void 0 ? void 0 : _a.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType;
|
|
240
|
+
return pageType === "MUSIC_PAGE_TYPE_ALBUM";
|
|
241
|
+
});
|
|
242
|
+
if (!albumRaw)
|
|
243
|
+
return;
|
|
244
|
+
var album = new MusicAlbumCompact({
|
|
245
|
+
client: client,
|
|
246
|
+
title: albumRaw.text,
|
|
247
|
+
id: (_a = albumRaw.navigationEndpoint) === null || _a === void 0 ? void 0 : _a.browseEndpoint.browseId,
|
|
248
|
+
});
|
|
249
|
+
return album;
|
|
250
|
+
};
|
|
251
|
+
MusicSearchResultParser.parseArtists = function (items, client) {
|
|
252
|
+
return this.parseArtistsOrChannel(items).map(function (r) {
|
|
253
|
+
var _a;
|
|
254
|
+
return new MusicBaseArtist({
|
|
255
|
+
client: client,
|
|
256
|
+
name: r.text,
|
|
257
|
+
id: (_a = r.navigationEndpoint) === null || _a === void 0 ? void 0 : _a.browseEndpoint.browseId,
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
MusicSearchResultParser.parseChannel = function (items, client) {
|
|
262
|
+
var _a;
|
|
263
|
+
var _b = __read(this.parseArtistsOrChannel(items), 1), channelRaw = _b[0];
|
|
264
|
+
if (!channelRaw)
|
|
265
|
+
return;
|
|
266
|
+
var channel = new MusicBaseChannel({
|
|
267
|
+
client: client,
|
|
268
|
+
name: channelRaw.text,
|
|
269
|
+
id: (_a = channelRaw.navigationEndpoint) === null || _a === void 0 ? void 0 : _a.browseEndpoint.browseId,
|
|
270
|
+
});
|
|
271
|
+
return channel;
|
|
272
|
+
};
|
|
273
|
+
MusicSearchResultParser.parseArtistsOrChannel = function (items) {
|
|
274
|
+
return items.filter(function (i) {
|
|
275
|
+
var _a;
|
|
276
|
+
var pageType = (_a = i.navigationEndpoint) === null || _a === void 0 ? void 0 : _a.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType;
|
|
277
|
+
return (pageType === "MUSIC_PAGE_TYPE_ARTIST" || pageType == "MUSIC_PAGE_TYPE_USER_CHANNEL");
|
|
278
|
+
});
|
|
279
|
+
};
|
|
62
280
|
return MusicSearchResultParser;
|
|
63
281
|
}());
|
|
64
282
|
export { MusicSearchResultParser };
|
|
@@ -15,6 +15,7 @@ import { Base } from "../Base";
|
|
|
15
15
|
import { BaseChannelParser } from "./BaseChannelParser";
|
|
16
16
|
import { ChannelLive } from "./ChannelLive";
|
|
17
17
|
import { ChannelPlaylists } from "./ChannelPlaylists";
|
|
18
|
+
import { ChannelPosts } from "./ChannelPosts";
|
|
18
19
|
import { ChannelShorts } from "./ChannelShorts";
|
|
19
20
|
import { ChannelVideos } from "./ChannelVideos";
|
|
20
21
|
/** Represents a Youtube Channel */
|
|
@@ -28,6 +29,7 @@ var BaseChannel = /** @class */ (function (_super) {
|
|
|
28
29
|
_this.shorts = new ChannelShorts({ channel: _this, client: _this.client });
|
|
29
30
|
_this.live = new ChannelLive({ channel: _this, client: _this.client });
|
|
30
31
|
_this.playlists = new ChannelPlaylists({ channel: _this, client: _this.client });
|
|
32
|
+
_this.posts = new ChannelPosts({ channel: _this, client: _this.client });
|
|
31
33
|
return _this;
|
|
32
34
|
}
|
|
33
35
|
Object.defineProperty(BaseChannel.prototype, "url", {
|
|
@@ -12,13 +12,13 @@ var BaseChannelParser = /** @class */ (function () {
|
|
|
12
12
|
};
|
|
13
13
|
/** Parse tab data from request, tab name is ignored if it's a continuation data */
|
|
14
14
|
BaseChannelParser.parseTabData = function (name, data) {
|
|
15
|
-
var _a, _b, _c, _d, _e;
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
16
16
|
var tab = (_a = data.contents) === null || _a === void 0 ? void 0 : _a.twoColumnBrowseResultsRenderer.tabs.find(function (t) {
|
|
17
17
|
var _a;
|
|
18
18
|
return (((_a = t.tabRenderer) === null || _a === void 0 ? void 0 : _a.endpoint.browseEndpoint.params) ===
|
|
19
19
|
BaseChannelParser.TAB_TYPE_PARAMS[name]);
|
|
20
20
|
});
|
|
21
|
-
return (((_d = (_c = (_b = tab === null || tab === void 0 ? void 0 : tab.tabRenderer.content.sectionListRenderer) === null || _b === void 0 ? void 0 : _b.contents) === null || _c === void 0 ? void 0 : _c[0].itemSectionRenderer.contents[0].gridRenderer) === null || _d === void 0 ? void 0 : _d.items) || (tab === null || tab === void 0 ? void 0 : tab.tabRenderer.content.richGridRenderer.contents.map(function (c) { var _a; return ((_a = c.richItemRenderer) === null || _a === void 0 ? void 0 : _a.content) || c; })) || ((
|
|
21
|
+
return (((_d = (_c = (_b = tab === null || tab === void 0 ? void 0 : tab.tabRenderer.content.sectionListRenderer) === null || _b === void 0 ? void 0 : _b.contents) === null || _c === void 0 ? void 0 : _c[0].itemSectionRenderer.contents[0].gridRenderer) === null || _d === void 0 ? void 0 : _d.items) || ((_h = (_g = (_f = (_e = tab === null || tab === void 0 ? void 0 : tab.tabRenderer.content) === null || _e === void 0 ? void 0 : _e.sectionListRenderer) === null || _f === void 0 ? void 0 : _f.contents) === null || _g === void 0 ? void 0 : _g[0].itemSectionRenderer) === null || _h === void 0 ? void 0 : _h.contents) || (tab === null || tab === void 0 ? void 0 : tab.tabRenderer.content.richGridRenderer.contents.map(function (c) { var _a; return ((_a = c.richItemRenderer) === null || _a === void 0 ? void 0 : _a.content) || c; })) || ((_j = data.onResponseReceivedActions) === null || _j === void 0 ? void 0 : _j[0].appendContinuationItemsAction.continuationItems.map(function (c) { var _a; return ((_a = c.richItemRenderer) === null || _a === void 0 ? void 0 : _a.content) || c; })) || ((_k = data.onResponseReceivedEndpoints) === null || _k === void 0 ? void 0 : _k[0].appendContinuationItemsAction.continuationItems) ||
|
|
22
22
|
[]);
|
|
23
23
|
};
|
|
24
24
|
BaseChannelParser.TAB_TYPE_PARAMS = {
|
|
@@ -26,6 +26,7 @@ var BaseChannelParser = /** @class */ (function () {
|
|
|
26
26
|
shorts: "EgZzaG9ydHPyBgUKA5oBAA%3D%3D",
|
|
27
27
|
live: "EgdzdHJlYW1z8gYECgJ6AA%3D%3D",
|
|
28
28
|
playlists: "EglwbGF5bGlzdHPyBgQKAkIA",
|
|
29
|
+
posts: "EgVwb3N0c_IGBAoCSgA%3D",
|
|
29
30
|
};
|
|
30
31
|
return BaseChannelParser;
|
|
31
32
|
}());
|
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
import { getContinuationFromItems
|
|
50
|
+
import { getContinuationFromItems } from "../../common";
|
|
51
51
|
import { Continuable } from "../Continuable";
|
|
52
52
|
import { PlaylistCompact } from "../PlaylistCompact";
|
|
53
53
|
import { I_END_POINT } from "../constants";
|
|
@@ -93,11 +93,19 @@ var ChannelPlaylists = /** @class */ (function (_super) {
|
|
|
93
93
|
response = _b.sent();
|
|
94
94
|
items = BaseChannelParser.parseTabData("playlists", response.data);
|
|
95
95
|
continuation = getContinuationFromItems(items);
|
|
96
|
-
data =
|
|
96
|
+
data = items.filter(function (i) { return "gridPlaylistRenderer" in i || "lockupViewModel" in i; });
|
|
97
97
|
return [2 /*return*/, {
|
|
98
98
|
continuation: continuation,
|
|
99
99
|
items: data.map(function (i) {
|
|
100
|
-
|
|
100
|
+
var playlist = new PlaylistCompact({
|
|
101
|
+
client: _this.client,
|
|
102
|
+
channel: _this.channel,
|
|
103
|
+
});
|
|
104
|
+
if (i.gridPlaylistRenderer)
|
|
105
|
+
playlist.load(i.gridPlaylistRenderer);
|
|
106
|
+
else if (i.lockupViewModel)
|
|
107
|
+
playlist.loadLockup(i.lockupViewModel);
|
|
108
|
+
return playlist;
|
|
101
109
|
}),
|
|
102
110
|
}];
|
|
103
111
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
+
function step(op) {
|
|
28
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
+
while (_) try {
|
|
30
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
31
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
+
switch (op[0]) {
|
|
33
|
+
case 0: case 1: t = op; break;
|
|
34
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
+
default:
|
|
38
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
+
if (t[2]) _.ops.pop();
|
|
43
|
+
_.trys.pop(); continue;
|
|
44
|
+
}
|
|
45
|
+
op = body.call(thisArg, _);
|
|
46
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
import { getContinuationFromItems } from "../../common";
|
|
51
|
+
import { Continuable } from "../Continuable";
|
|
52
|
+
import { Post } from "../Post";
|
|
53
|
+
import { I_END_POINT } from "../constants";
|
|
54
|
+
import { BaseChannelParser } from "./BaseChannelParser";
|
|
55
|
+
/**
|
|
56
|
+
* {@link Continuable} of posts inside a {@link BaseChannel}
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```js
|
|
60
|
+
* const channel = await youtube.findOne(CHANNEL_NAME, {type: "channel"});
|
|
61
|
+
* await channel.posts.next();
|
|
62
|
+
* console.log(channel.posts.items) // first 30 posts
|
|
63
|
+
*
|
|
64
|
+
* let newPosts = await channel.posts.next();
|
|
65
|
+
* console.log(newPosts) // 30 loaded posts
|
|
66
|
+
* console.log(channel.posts.items) // first 60 posts
|
|
67
|
+
*
|
|
68
|
+
* await channel.posts.next(0); // load the rest of the posts in the channel
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
var ChannelPosts = /** @class */ (function (_super) {
|
|
72
|
+
__extends(ChannelPosts, _super);
|
|
73
|
+
/** @hidden */
|
|
74
|
+
function ChannelPosts(_a) {
|
|
75
|
+
var client = _a.client, channel = _a.channel;
|
|
76
|
+
var _this = _super.call(this, { client: client, strictContinuationCheck: true }) || this;
|
|
77
|
+
_this.channel = channel;
|
|
78
|
+
return _this;
|
|
79
|
+
}
|
|
80
|
+
ChannelPosts.prototype.fetch = function () {
|
|
81
|
+
var _a;
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var params, response, items, continuation, data;
|
|
84
|
+
var _this = this;
|
|
85
|
+
return __generator(this, function (_b) {
|
|
86
|
+
switch (_b.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
params = BaseChannelParser.TAB_TYPE_PARAMS.posts;
|
|
89
|
+
return [4 /*yield*/, this.client.http.post(I_END_POINT + "/browse", {
|
|
90
|
+
data: { browseId: (_a = this.channel) === null || _a === void 0 ? void 0 : _a.id, params: params, continuation: this.continuation },
|
|
91
|
+
})];
|
|
92
|
+
case 1:
|
|
93
|
+
response = _b.sent();
|
|
94
|
+
items = BaseChannelParser.parseTabData("posts", response.data);
|
|
95
|
+
continuation = getContinuationFromItems(items);
|
|
96
|
+
data = items
|
|
97
|
+
.map(function (i) { var _a, _b; return (_b = (_a = i.backstagePostThreadRenderer) === null || _a === void 0 ? void 0 : _a.post) === null || _b === void 0 ? void 0 : _b.backstagePostRenderer; })
|
|
98
|
+
.filter(function (i) { return i !== undefined; });
|
|
99
|
+
return [2 /*return*/, {
|
|
100
|
+
continuation: continuation,
|
|
101
|
+
items: data.map(function (i) {
|
|
102
|
+
return new Post({ client: _this.client, channel: _this.channel }).load(i);
|
|
103
|
+
}),
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
return ChannelPosts;
|
|
110
|
+
}(Continuable));
|
|
111
|
+
export { ChannelPosts };
|
|
@@ -47,7 +47,7 @@ var BaseVideoParser = /** @class */ (function () {
|
|
|
47
47
|
target.description = videoInfo.videoDetails.shortDescription || "";
|
|
48
48
|
// related videos
|
|
49
49
|
var secondaryContents = (_c = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _c === void 0 ? void 0 : _c.secondaryResults.results;
|
|
50
|
-
var itemSectionRenderer = (_d = secondaryContents.find(function (c) {
|
|
50
|
+
var itemSectionRenderer = (_d = secondaryContents === null || secondaryContents === void 0 ? void 0 : secondaryContents.find(function (c) {
|
|
51
51
|
return c.itemSectionRenderer;
|
|
52
52
|
})) === null || _d === void 0 ? void 0 : _d.itemSectionRenderer;
|
|
53
53
|
if (itemSectionRenderer)
|
|
@@ -17,9 +17,9 @@ var ChannelParser = /** @class */ (function () {
|
|
|
17
17
|
function ChannelParser() {
|
|
18
18
|
}
|
|
19
19
|
ChannelParser.loadChannel = function (target, data) {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21
21
|
var channelId, title, handle, description, avatar, subscriberCountText, videoCountText, tvBanner, mobileBanner, banner;
|
|
22
|
-
var
|
|
22
|
+
var _k = data.header, c4TabbedHeaderRenderer = _k.c4TabbedHeaderRenderer, pageHeaderRenderer = _k.pageHeaderRenderer;
|
|
23
23
|
if (c4TabbedHeaderRenderer) {
|
|
24
24
|
channelId = c4TabbedHeaderRenderer.channelId;
|
|
25
25
|
title = c4TabbedHeaderRenderer.title;
|
|
@@ -35,12 +35,16 @@ var ChannelParser = /** @class */ (function () {
|
|
|
35
35
|
data.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.endpoint
|
|
36
36
|
.browseEndpoint.browseId;
|
|
37
37
|
title = pageHeaderRenderer.pageTitle;
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
var _l = pageHeaderRenderer.content.pageHeaderViewModel, metadata = _l.metadata, imageModel = _l.image, bannerModel = _l.banner, descriptionModel = _l.description;
|
|
39
|
+
var metadataParts = metadata.contentMetadataViewModel.metadataRows
|
|
40
|
+
.map(function (m) { return m.metadataParts; })
|
|
41
|
+
.flat();
|
|
42
|
+
var handlePart = metadataParts.find(function (m) { var _a; return (_a = m.text.styleRuns) === null || _a === void 0 ? void 0 : _a.some(function (s) { return "weightLabel" in s; }); });
|
|
43
|
+
var subscriberCountPart = metadataParts.find(function (m) { return m.accessibilityLabel; });
|
|
44
|
+
var videoCountPart = metadataParts.find(function (m) { var _a; return (_a = m.text.styleRuns) === null || _a === void 0 ? void 0 : _a.some(function (s) { return "startIndex" in s; }); });
|
|
45
|
+
handle = (_j = handlePart === null || handlePart === void 0 ? void 0 : handlePart.text) === null || _j === void 0 ? void 0 : _j.content;
|
|
46
|
+
videoCountText = videoCountPart === null || videoCountPart === void 0 ? void 0 : videoCountPart.text.content;
|
|
47
|
+
subscriberCountText = subscriberCountPart === null || subscriberCountPart === void 0 ? void 0 : subscriberCountPart.text.content;
|
|
44
48
|
avatar = imageModel.decoratedAvatarViewModel.avatar.avatarViewModel.image.sources;
|
|
45
49
|
banner = bannerModel === null || bannerModel === void 0 ? void 0 : bannerModel.imageBannerViewModel.image.sources;
|
|
46
50
|
description = descriptionModel === null || descriptionModel === void 0 ? void 0 : descriptionModel.descriptionPreviewViewModel.description.content;
|
|
@@ -23,11 +23,11 @@ var PlaylistCompactParser = /** @class */ (function () {
|
|
|
23
23
|
return target;
|
|
24
24
|
};
|
|
25
25
|
PlaylistCompactParser.loadLockupPlaylistCompact = function (target, data) {
|
|
26
|
+
var _a;
|
|
26
27
|
var lockupMetadataViewModel = data.metadata.lockupMetadataViewModel;
|
|
27
|
-
var channelMetadata = lockupMetadataViewModel.metadata.contentMetadataViewModel.metadataRows[0]
|
|
28
|
-
.metadataParts[0];
|
|
28
|
+
var channelMetadata = (_a = lockupMetadataViewModel.metadata.contentMetadataViewModel.metadataRows) === null || _a === void 0 ? void 0 : _a[0].metadataParts[0];
|
|
29
29
|
var thumbnailViewModel = data.contentImage.collectionThumbnailViewModel.primaryThumbnail.thumbnailViewModel;
|
|
30
|
-
if (channelMetadata.text.commandRuns) {
|
|
30
|
+
if (channelMetadata === null || channelMetadata === void 0 ? void 0 : channelMetadata.text.commandRuns) {
|
|
31
31
|
// not a mix
|
|
32
32
|
var channel = new BaseChannel({
|
|
33
33
|
client: target.client,
|