youtubei 1.3.1 → 1.3.3
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.
|
@@ -5,10 +5,18 @@ const MusicAllSearchResultParser_1 = require("./MusicAllSearchResultParser");
|
|
|
5
5
|
class MusicSearchResultParser {
|
|
6
6
|
static parseInitialSearchResult(data, type, client) {
|
|
7
7
|
var _a, _b;
|
|
8
|
-
const
|
|
8
|
+
const contentSection = data.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.find((c) => "musicShelfRenderer" in c);
|
|
9
|
+
if (!contentSection) {
|
|
10
|
+
// no results
|
|
11
|
+
return {
|
|
12
|
+
data: [],
|
|
13
|
+
continuation: undefined,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const { contents, continuations } = contentSection.musicShelfRenderer;
|
|
9
17
|
return {
|
|
10
18
|
data: MusicSearchResultParser.parseSearchResult(contents, type, client),
|
|
11
|
-
continuation: (_b = (_a = continuations[0]) === null || _a === void 0 ? void 0 : _a.nextContinuationData) === null || _b === void 0 ? void 0 : _b.continuation,
|
|
19
|
+
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,
|
|
12
20
|
};
|
|
13
21
|
}
|
|
14
22
|
static parseContinuationSearchResult(data, type, client) {
|
|
@@ -15,10 +15,18 @@ var MusicSearchResultParser = /** @class */ (function () {
|
|
|
15
15
|
}
|
|
16
16
|
MusicSearchResultParser.parseInitialSearchResult = function (data, type, client) {
|
|
17
17
|
var _a, _b;
|
|
18
|
-
var
|
|
18
|
+
var contentSection = data.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.find(function (c) { return "musicShelfRenderer" in c; });
|
|
19
|
+
if (!contentSection) {
|
|
20
|
+
// no results
|
|
21
|
+
return {
|
|
22
|
+
data: [],
|
|
23
|
+
continuation: undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var _c = contentSection.musicShelfRenderer, contents = _c.contents, continuations = _c.continuations;
|
|
19
27
|
return {
|
|
20
28
|
data: MusicSearchResultParser.parseSearchResult(contents, type, client),
|
|
21
|
-
continuation: (_b = (_a = continuations[0]) === null || _a === void 0 ? void 0 : _a.nextContinuationData) === null || _b === void 0 ? void 0 : _b.continuation,
|
|
29
|
+
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,
|
|
22
30
|
};
|
|
23
31
|
};
|
|
24
32
|
MusicSearchResultParser.parseContinuationSearchResult = function (data, type, client) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "youtubei",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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",
|