youtubei 1.6.3 → 1.6.4

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.
@@ -8,7 +8,7 @@ const VideoCompact_1 = require("../VideoCompact");
8
8
  const VideoCaptions_1 = require("./VideoCaptions");
9
9
  class BaseVideoParser {
10
10
  static loadBaseVideo(target, data) {
11
- var _a, _b, _c;
11
+ var _a, _b, _c, _d;
12
12
  const videoInfo = BaseVideoParser.parseRawData(data);
13
13
  // Basic information
14
14
  target.id = videoInfo.videoDetails.videoId;
@@ -34,7 +34,12 @@ class BaseVideoParser {
34
34
  ((_b = (_a = videoInfo.superTitleLink) === null || _a === void 0 ? void 0 : _a.runs) === null || _b === void 0 ? void 0 : _b.map((r) => r.text.trim()).filter((t) => t)) || [];
35
35
  target.description = videoInfo.videoDetails.shortDescription || "";
36
36
  // related videos
37
- const secondaryContents = (_c = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _c === void 0 ? void 0 : _c.secondaryResults.results;
37
+ let secondaryContents = (_c = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _c === void 0 ? void 0 : _c.secondaryResults.results;
38
+ const itemSectionRenderer = (_d = secondaryContents.find((c) => {
39
+ return c.itemSectionRenderer;
40
+ })) === null || _d === void 0 ? void 0 : _d.itemSectionRenderer;
41
+ if (itemSectionRenderer)
42
+ secondaryContents = itemSectionRenderer.contents;
38
43
  if (secondaryContents) {
39
44
  target.related.items = BaseVideoParser.parseRelatedFromSecondaryContent(secondaryContents, target.client);
40
45
  target.related.continuation = common_1.getContinuationFromItems(secondaryContents);
@@ -18,7 +18,7 @@ var BaseVideoParser = /** @class */ (function () {
18
18
  function BaseVideoParser() {
19
19
  }
20
20
  BaseVideoParser.loadBaseVideo = function (target, data) {
21
- var _a, _b, _c;
21
+ var _a, _b, _c, _d;
22
22
  var videoInfo = BaseVideoParser.parseRawData(data);
23
23
  // Basic information
24
24
  target.id = videoInfo.videoDetails.videoId;
@@ -28,7 +28,7 @@ var BaseVideoParser = /** @class */ (function () {
28
28
  target.isLiveContent = videoInfo.videoDetails.isLiveContent;
29
29
  target.thumbnails = new Thumbnails().load(videoInfo.videoDetails.thumbnail.thumbnails);
30
30
  // Channel
31
- var _d = videoInfo.owner.videoOwnerRenderer, title = _d.title, thumbnail = _d.thumbnail, subscriberCountText = _d.subscriberCountText;
31
+ var _e = videoInfo.owner.videoOwnerRenderer, title = _e.title, thumbnail = _e.thumbnail, subscriberCountText = _e.subscriberCountText;
32
32
  target.channel = new BaseChannel({
33
33
  client: target.client,
34
34
  id: title.runs[0].navigationEndpoint.browseEndpoint.browseId,
@@ -45,6 +45,11 @@ var BaseVideoParser = /** @class */ (function () {
45
45
  target.description = videoInfo.videoDetails.shortDescription || "";
46
46
  // related videos
47
47
  var secondaryContents = (_c = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _c === void 0 ? void 0 : _c.secondaryResults.results;
48
+ var itemSectionRenderer = (_d = secondaryContents.find(function (c) {
49
+ return c.itemSectionRenderer;
50
+ })) === null || _d === void 0 ? void 0 : _d.itemSectionRenderer;
51
+ if (itemSectionRenderer)
52
+ secondaryContents = itemSectionRenderer.contents;
48
53
  if (secondaryContents) {
49
54
  target.related.items = BaseVideoParser.parseRelatedFromSecondaryContent(secondaryContents, target.client);
50
55
  target.related.continuation = getContinuationFromItems(secondaryContents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "youtubei",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
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",