youtubei 1.8.6 → 1.8.8

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapFilter = exports.getContinuationFromItems = exports.stripToInt = exports.getDuration = void 0;
3
+ exports.getThumbnailFromId = exports.mapFilter = exports.getContinuationFromItems = exports.stripToInt = exports.getDuration = void 0;
4
4
  const getDuration = (s) => {
5
5
  s = s.replace(/:/g, ".");
6
6
  const spl = s.split(".");
@@ -47,3 +47,23 @@ const mapFilter = (items, key) => {
47
47
  .map((item) => item[key]);
48
48
  };
49
49
  exports.mapFilter = mapFilter;
50
+ const getThumbnailFromId = (id) => {
51
+ return [
52
+ {
53
+ url: `https://i.ytimg.com/vi/${id}/default.jpg`,
54
+ width: 120,
55
+ height: 90,
56
+ },
57
+ {
58
+ url: `https://i.ytimg.com/vi/${id}/mqdefault.jpg`,
59
+ width: 320,
60
+ height: 180,
61
+ },
62
+ {
63
+ url: `https://i.ytimg.com/vi/${id}/hqdefault.jpg`,
64
+ width: 480,
65
+ height: 360,
66
+ },
67
+ ];
68
+ };
69
+ exports.getThumbnailFromId = getThumbnailFromId;
@@ -8,17 +8,19 @@ 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, _d, _e, _f;
11
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12
12
  const videoInfo = BaseVideoParser.parseRawData(data);
13
13
  // Basic information
14
- target.id = videoInfo.videoDetails.videoId;
15
- target.title = videoInfo.videoDetails.title;
14
+ target.id = videoInfo.currentVideoEndpoint.watchEndpoint.videoId;
15
+ target.title =
16
+ videoInfo.playerOverlays.playerOverlayRenderer.videoDetails.playerOverlayVideoDetailsRenderer.title.simpleText;
17
+ target.viewCount =
18
+ common_1.stripToInt(videoInfo.viewCount.videoViewCountRenderer.viewCount.simpleText) || null;
19
+ target.isLiveContent = !!((_a = videoInfo.videoDetails) === null || _a === void 0 ? void 0 : _a.isLiveContent); // TODO remove dependence on player data
16
20
  target.uploadDate = videoInfo.dateText.simpleText;
17
- target.viewCount = +videoInfo.videoDetails.viewCount || null;
18
- target.isLiveContent = videoInfo.videoDetails.isLiveContent;
19
- target.formats = ((_a = videoInfo.streamingData) === null || _a === void 0 ? void 0 : _a.formats) || [];
20
- target.adaptiveFormats = ((_b = videoInfo.streamingData) === null || _b === void 0 ? void 0 : _b.adaptiveFormats) || [];
21
- target.thumbnails = new common_1.Thumbnails().load(videoInfo.videoDetails.thumbnail.thumbnails);
21
+ target.formats = ((_b = videoInfo.streamingData) === null || _b === void 0 ? void 0 : _b.formats) || [];
22
+ target.adaptiveFormats = ((_c = videoInfo.streamingData) === null || _c === void 0 ? void 0 : _c.adaptiveFormats) || [];
23
+ target.thumbnails = new common_1.Thumbnails().load(((_d = videoInfo.videoDetails) === null || _d === void 0 ? void 0 : _d.thumbnail.thumbnails) || common_1.getThumbnailFromId(target.id));
22
24
  // Channel
23
25
  const { title, thumbnail, subscriberCountText } = videoInfo.owner.videoOwnerRenderer;
24
26
  if (title) {
@@ -55,13 +57,16 @@ class BaseVideoParser {
55
57
  : null;
56
58
  // Tags and description
57
59
  target.tags =
58
- ((_d = (_c = videoInfo.superTitleLink) === null || _c === void 0 ? void 0 : _c.runs) === null || _d === void 0 ? void 0 : _d.map((r) => r.text.trim()).filter((t) => t)) || [];
59
- target.description = videoInfo.videoDetails.shortDescription || "";
60
+ ((_f = (_e = videoInfo.superTitleLink) === null || _e === void 0 ? void 0 : _e.runs) === null || _f === void 0 ? void 0 : _f.map((r) => r.text.trim()).filter((t) => t)) || [];
61
+ target.description =
62
+ ((_g = videoInfo.videoDetails) === null || _g === void 0 ? void 0 : _g.shortDescription) ||
63
+ videoInfo.attributedDescription.content ||
64
+ "";
60
65
  // related videos
61
- let secondaryContents = (_e = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _e === void 0 ? void 0 : _e.secondaryResults.results;
62
- const itemSectionRenderer = (_f = secondaryContents === null || secondaryContents === void 0 ? void 0 : secondaryContents.find((c) => {
66
+ let secondaryContents = (_h = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _h === void 0 ? void 0 : _h.secondaryResults.results;
67
+ const itemSectionRenderer = (_j = secondaryContents === null || secondaryContents === void 0 ? void 0 : secondaryContents.find((c) => {
63
68
  return c.itemSectionRenderer;
64
- })) === null || _f === void 0 ? void 0 : _f.itemSectionRenderer;
69
+ })) === null || _j === void 0 ? void 0 : _j.itemSectionRenderer;
65
70
  if (itemSectionRenderer)
66
71
  secondaryContents = itemSectionRenderer.contents;
67
72
  if (secondaryContents) {
@@ -88,7 +93,9 @@ class BaseVideoParser {
88
93
  .videoPrimaryInfoRenderer;
89
94
  const secondaryInfo = contents.find((c) => "videoSecondaryInfoRenderer" in c).videoSecondaryInfoRenderer;
90
95
  const { videoDetails, captions, streamingData } = data.playerResponse;
91
- return Object.assign(Object.assign(Object.assign({}, secondaryInfo), primaryInfo), { videoDetails, captions, streamingData });
96
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, data.response), secondaryInfo), primaryInfo), { videoDetails,
97
+ captions,
98
+ streamingData });
92
99
  }
93
100
  static parseCompactRenderer(data, client) {
94
101
  if ("compactVideoRenderer" in data) {
@@ -82,10 +82,15 @@ class Client {
82
82
  getVideo(videoId) {
83
83
  var _a, _b;
84
84
  return __awaiter(this, void 0, void 0, function* () {
85
- const nextPromise = this.http.post(`${constants_1.I_END_POINT}/next`, { data: { videoId } });
86
- const playerPromise = this.http.post(`${constants_1.I_END_POINT}/player`, { data: { videoId } });
87
- const [nextResponse, playerResponse] = yield Promise.all([nextPromise, playerPromise]);
88
- const data = { response: nextResponse.data, playerResponse: playerResponse.data };
85
+ const response = yield this.http.post(`${constants_1.I_END_POINT}/get_watch`, {
86
+ data: { playerRequest: { videoId }, watchNextRequest: { videoId } },
87
+ });
88
+ const data = {
89
+ response: response.data.find((r) => "watchNextResponse" in r)
90
+ .watchNextResponse,
91
+ playerResponse: response.data.find((r) => "playerResponse" in r)
92
+ .playerResponse,
93
+ };
89
94
  if (!((_b = (_a = data.response) === null || _a === void 0 ? void 0 : _a.contents) === null || _b === void 0 ? void 0 : _b.twoColumnWatchNextResults.results.results.contents) ||
90
95
  data.playerResponse.playabilityStatus.status === "ERROR") {
91
96
  return undefined;
@@ -6,21 +6,26 @@ const BaseVideo_1 = require("../BaseVideo");
6
6
  const Comment_1 = require("../Comment");
7
7
  class VideoParser {
8
8
  static loadVideo(target, data) {
9
- var _a, _b, _c, _d, _e, _f;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h;
10
10
  const videoInfo = BaseVideo_1.BaseVideoParser.parseRawData(data);
11
- target.duration = +videoInfo.videoDetails.lengthSeconds;
12
- const itemSectionRenderer = (_a = data.response.contents.twoColumnWatchNextResults.results.results.contents
11
+ const mutations = videoInfo.frameworkUpdates.entityBatchUpdate.mutations;
12
+ const lastMarkers = (_a = mutations
13
+ .find((m) => { var _a; return (_a = m.payload) === null || _a === void 0 ? void 0 : _a.macroMarkersListEntity; })) === null || _a === void 0 ? void 0 : _a.payload.macroMarkersListEntity.markersList.markers.at(-1);
14
+ target.duration =
15
+ +((_b = videoInfo.videoDetails) === null || _b === void 0 ? void 0 : _b.lengthSeconds) ||
16
+ (lastMarkers ? (+lastMarkers.startMillis + +lastMarkers.durationMillis) / 1000 : 0);
17
+ const itemSectionRenderer = (_c = data.response.contents.twoColumnWatchNextResults.results.results.contents
13
18
  .reverse()
14
- .find((c) => c.itemSectionRenderer)) === null || _a === void 0 ? void 0 : _a.itemSectionRenderer;
19
+ .find((c) => c.itemSectionRenderer)) === null || _c === void 0 ? void 0 : _c.itemSectionRenderer;
15
20
  target.comments.continuation = common_1.getContinuationFromItems((itemSectionRenderer === null || itemSectionRenderer === void 0 ? void 0 : itemSectionRenderer.contents) || []);
16
- const chapters = (_d = (_c = (_b = data.response.playerOverlays.playerOverlayRenderer.decoratedPlayerBarRenderer) === null || _b === void 0 ? void 0 : _b.decoratedPlayerBarRenderer.playerBar) === null || _c === void 0 ? void 0 : _c.multiMarkersPlayerBarRenderer.markersMap) === null || _d === void 0 ? void 0 : _d[0].value.chapters;
21
+ const chapters = (_f = (_e = (_d = data.response.playerOverlays.playerOverlayRenderer.decoratedPlayerBarRenderer) === null || _d === void 0 ? void 0 : _d.decoratedPlayerBarRenderer.playerBar) === null || _e === void 0 ? void 0 : _e.multiMarkersPlayerBarRenderer.markersMap) === null || _f === void 0 ? void 0 : _f[0].value.chapters;
17
22
  target.chapters =
18
23
  (chapters === null || chapters === void 0 ? void 0 : chapters.map(({ chapterRenderer: c }) => ({
19
24
  title: c.title.simpleText,
20
25
  start: c.timeRangeStartMillis,
21
26
  thumbnails: new common_1.Thumbnails().load(c.thumbnail.thumbnails),
22
27
  }))) || [];
23
- const musicPanel = (_e = data.response.engagementPanels) === null || _e === void 0 ? void 0 : _e.find((e) => { var _a, _b; return (_b = (_a = e.engagementPanelSectionListRenderer.content) === null || _a === void 0 ? void 0 : _a.structuredDescriptionContentRenderer) === null || _b === void 0 ? void 0 : _b.items.find((i) => { var _a, _b; return ((_b = (_a = i.horizontalCardListRenderer) === null || _a === void 0 ? void 0 : _a.footerButton) === null || _b === void 0 ? void 0 : _b.buttonViewModel.iconName) === "MUSIC"; }); });
28
+ const musicPanel = (_g = data.response.engagementPanels) === null || _g === void 0 ? void 0 : _g.find((e) => { var _a, _b; return (_b = (_a = e.engagementPanelSectionListRenderer.content) === null || _a === void 0 ? void 0 : _a.structuredDescriptionContentRenderer) === null || _b === void 0 ? void 0 : _b.items.find((i) => { var _a, _b; return ((_b = (_a = i.horizontalCardListRenderer) === null || _a === void 0 ? void 0 : _a.footerButton) === null || _b === void 0 ? void 0 : _b.buttonViewModel.iconName) === "MUSIC"; }); });
24
29
  if (!musicPanel) {
25
30
  target.music = null;
26
31
  }
@@ -32,7 +37,7 @@ class VideoParser {
32
37
  imageUrl: music.image.sources[0].url,
33
38
  title: music.title,
34
39
  artist: music.subtitle,
35
- album: ((_f = music.secondarySubtitle) === null || _f === void 0 ? void 0 : _f.content) || null,
40
+ album: ((_h = music.secondarySubtitle) === null || _h === void 0 ? void 0 : _h.content) || null,
36
41
  };
37
42
  }
38
43
  // target.music =
@@ -63,3 +63,22 @@ export var mapFilter = function (items, key) {
63
63
  .filter(function (item) { return item[key]; })
64
64
  .map(function (item) { return item[key]; });
65
65
  };
66
+ export var getThumbnailFromId = function (id) {
67
+ return [
68
+ {
69
+ url: "https://i.ytimg.com/vi/" + id + "/default.jpg",
70
+ width: 120,
71
+ height: 90,
72
+ },
73
+ {
74
+ url: "https://i.ytimg.com/vi/" + id + "/mqdefault.jpg",
75
+ width: 320,
76
+ height: 180,
77
+ },
78
+ {
79
+ url: "https://i.ytimg.com/vi/" + id + "/hqdefault.jpg",
80
+ width: 480,
81
+ height: 360,
82
+ },
83
+ ];
84
+ };
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { getContinuationFromItems, stripToInt, Thumbnails } from "../../common";
12
+ import { getContinuationFromItems, getThumbnailFromId, stripToInt, Thumbnails, } from "../../common";
13
13
  import { BaseChannel } from "../BaseChannel";
14
14
  import { PlaylistCompact } from "../PlaylistCompact";
15
15
  import { VideoCompact } from "../VideoCompact";
@@ -18,19 +18,21 @@ var BaseVideoParser = /** @class */ (function () {
18
18
  function BaseVideoParser() {
19
19
  }
20
20
  BaseVideoParser.loadBaseVideo = function (target, data) {
21
- var _a, _b, _c, _d, _e, _f;
21
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22
22
  var videoInfo = BaseVideoParser.parseRawData(data);
23
23
  // Basic information
24
- target.id = videoInfo.videoDetails.videoId;
25
- target.title = videoInfo.videoDetails.title;
24
+ target.id = videoInfo.currentVideoEndpoint.watchEndpoint.videoId;
25
+ target.title =
26
+ videoInfo.playerOverlays.playerOverlayRenderer.videoDetails.playerOverlayVideoDetailsRenderer.title.simpleText;
27
+ target.viewCount =
28
+ stripToInt(videoInfo.viewCount.videoViewCountRenderer.viewCount.simpleText) || null;
29
+ target.isLiveContent = !!((_a = videoInfo.videoDetails) === null || _a === void 0 ? void 0 : _a.isLiveContent); // TODO remove dependence on player data
26
30
  target.uploadDate = videoInfo.dateText.simpleText;
27
- target.viewCount = +videoInfo.videoDetails.viewCount || null;
28
- target.isLiveContent = videoInfo.videoDetails.isLiveContent;
29
- target.formats = ((_a = videoInfo.streamingData) === null || _a === void 0 ? void 0 : _a.formats) || [];
30
- target.adaptiveFormats = ((_b = videoInfo.streamingData) === null || _b === void 0 ? void 0 : _b.adaptiveFormats) || [];
31
- target.thumbnails = new Thumbnails().load(videoInfo.videoDetails.thumbnail.thumbnails);
31
+ target.formats = ((_b = videoInfo.streamingData) === null || _b === void 0 ? void 0 : _b.formats) || [];
32
+ target.adaptiveFormats = ((_c = videoInfo.streamingData) === null || _c === void 0 ? void 0 : _c.adaptiveFormats) || [];
33
+ target.thumbnails = new Thumbnails().load(((_d = videoInfo.videoDetails) === null || _d === void 0 ? void 0 : _d.thumbnail.thumbnails) || getThumbnailFromId(target.id));
32
34
  // Channel
33
- var _g = videoInfo.owner.videoOwnerRenderer, title = _g.title, thumbnail = _g.thumbnail, subscriberCountText = _g.subscriberCountText;
35
+ var _k = videoInfo.owner.videoOwnerRenderer, title = _k.title, thumbnail = _k.thumbnail, subscriberCountText = _k.subscriberCountText;
34
36
  if (title) {
35
37
  target.channel = new BaseChannel({
36
38
  client: target.client,
@@ -65,13 +67,16 @@ var BaseVideoParser = /** @class */ (function () {
65
67
  : null;
66
68
  // Tags and description
67
69
  target.tags =
68
- ((_d = (_c = videoInfo.superTitleLink) === null || _c === void 0 ? void 0 : _c.runs) === null || _d === void 0 ? void 0 : _d.map(function (r) { return r.text.trim(); }).filter(function (t) { return t; })) || [];
69
- target.description = videoInfo.videoDetails.shortDescription || "";
70
+ ((_f = (_e = videoInfo.superTitleLink) === null || _e === void 0 ? void 0 : _e.runs) === null || _f === void 0 ? void 0 : _f.map(function (r) { return r.text.trim(); }).filter(function (t) { return t; })) || [];
71
+ target.description =
72
+ ((_g = videoInfo.videoDetails) === null || _g === void 0 ? void 0 : _g.shortDescription) ||
73
+ videoInfo.attributedDescription.content ||
74
+ "";
70
75
  // related videos
71
- var secondaryContents = (_e = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _e === void 0 ? void 0 : _e.secondaryResults.results;
72
- var itemSectionRenderer = (_f = secondaryContents === null || secondaryContents === void 0 ? void 0 : secondaryContents.find(function (c) {
76
+ var secondaryContents = (_h = data.response.contents.twoColumnWatchNextResults.secondaryResults) === null || _h === void 0 ? void 0 : _h.secondaryResults.results;
77
+ var itemSectionRenderer = (_j = secondaryContents === null || secondaryContents === void 0 ? void 0 : secondaryContents.find(function (c) {
73
78
  return c.itemSectionRenderer;
74
- })) === null || _f === void 0 ? void 0 : _f.itemSectionRenderer;
79
+ })) === null || _j === void 0 ? void 0 : _j.itemSectionRenderer;
75
80
  if (itemSectionRenderer)
76
81
  secondaryContents = itemSectionRenderer.contents;
77
82
  if (secondaryContents) {
@@ -98,7 +103,9 @@ var BaseVideoParser = /** @class */ (function () {
98
103
  .videoPrimaryInfoRenderer;
99
104
  var secondaryInfo = contents.find(function (c) { return "videoSecondaryInfoRenderer" in c; }).videoSecondaryInfoRenderer;
100
105
  var _a = data.playerResponse, videoDetails = _a.videoDetails, captions = _a.captions, streamingData = _a.streamingData;
101
- return __assign(__assign(__assign({}, secondaryInfo), primaryInfo), { videoDetails: videoDetails, captions: captions, streamingData: streamingData });
106
+ return __assign(__assign(__assign(__assign({}, data.response), secondaryInfo), primaryInfo), { videoDetails: videoDetails,
107
+ captions: captions,
108
+ streamingData: streamingData });
102
109
  };
103
110
  BaseVideoParser.parseCompactRenderer = function (data, client) {
104
111
  if ("compactVideoRenderer" in data) {
@@ -45,22 +45,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- var __read = (this && this.__read) || function (o, n) {
49
- var m = typeof Symbol === "function" && o[Symbol.iterator];
50
- if (!m) return o;
51
- var i = m.call(o), r, ar = [], e;
52
- try {
53
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
54
- }
55
- catch (error) { e = { error: error }; }
56
- finally {
57
- try {
58
- if (r && !r.done && (m = i["return"])) m.call(i);
59
- }
60
- finally { if (e) throw e.error; }
61
- }
62
- return ar;
63
- };
64
48
  import { HTTP } from "../../common";
65
49
  import { Channel } from "../Channel";
66
50
  import { LiveVideo } from "../LiveVideo";
@@ -162,16 +146,20 @@ var Client = /** @class */ (function () {
162
146
  Client.prototype.getVideo = function (videoId) {
163
147
  var _a, _b;
164
148
  return __awaiter(this, void 0, void 0, function () {
165
- var nextPromise, playerPromise, _c, nextResponse, playerResponse, data;
166
- return __generator(this, function (_d) {
167
- switch (_d.label) {
168
- case 0:
169
- nextPromise = this.http.post(I_END_POINT + "/next", { data: { videoId: videoId } });
170
- playerPromise = this.http.post(I_END_POINT + "/player", { data: { videoId: videoId } });
171
- return [4 /*yield*/, Promise.all([nextPromise, playerPromise])];
149
+ var response, data;
150
+ return __generator(this, function (_c) {
151
+ switch (_c.label) {
152
+ case 0: return [4 /*yield*/, this.http.post(I_END_POINT + "/get_watch", {
153
+ data: { playerRequest: { videoId: videoId }, watchNextRequest: { videoId: videoId } },
154
+ })];
172
155
  case 1:
173
- _c = __read.apply(void 0, [_d.sent(), 2]), nextResponse = _c[0], playerResponse = _c[1];
174
- data = { response: nextResponse.data, playerResponse: playerResponse.data };
156
+ response = _c.sent();
157
+ data = {
158
+ response: response.data.find(function (r) { return "watchNextResponse" in r; })
159
+ .watchNextResponse,
160
+ playerResponse: response.data.find(function (r) { return "playerResponse" in r; })
161
+ .playerResponse,
162
+ };
175
163
  if (!((_b = (_a = data.response) === null || _a === void 0 ? void 0 : _a.contents) === null || _b === void 0 ? void 0 : _b.twoColumnWatchNextResults.results.results.contents) ||
176
164
  data.playerResponse.playabilityStatus.status === "ERROR") {
177
165
  return [2 /*return*/, undefined];
@@ -16,14 +16,19 @@ var VideoParser = /** @class */ (function () {
16
16
  function VideoParser() {
17
17
  }
18
18
  VideoParser.loadVideo = function (target, data) {
19
- var _a, _b, _c, _d, _e, _f;
19
+ var _a, _b, _c, _d, _e, _f, _g, _h;
20
20
  var videoInfo = BaseVideoParser.parseRawData(data);
21
- target.duration = +videoInfo.videoDetails.lengthSeconds;
22
- var itemSectionRenderer = (_a = data.response.contents.twoColumnWatchNextResults.results.results.contents
21
+ var mutations = videoInfo.frameworkUpdates.entityBatchUpdate.mutations;
22
+ var lastMarkers = (_a = mutations
23
+ .find(function (m) { var _a; return (_a = m.payload) === null || _a === void 0 ? void 0 : _a.macroMarkersListEntity; })) === null || _a === void 0 ? void 0 : _a.payload.macroMarkersListEntity.markersList.markers.at(-1);
24
+ target.duration =
25
+ +((_b = videoInfo.videoDetails) === null || _b === void 0 ? void 0 : _b.lengthSeconds) ||
26
+ (lastMarkers ? (+lastMarkers.startMillis + +lastMarkers.durationMillis) / 1000 : 0);
27
+ var itemSectionRenderer = (_c = data.response.contents.twoColumnWatchNextResults.results.results.contents
23
28
  .reverse()
24
- .find(function (c) { return c.itemSectionRenderer; })) === null || _a === void 0 ? void 0 : _a.itemSectionRenderer;
29
+ .find(function (c) { return c.itemSectionRenderer; })) === null || _c === void 0 ? void 0 : _c.itemSectionRenderer;
25
30
  target.comments.continuation = getContinuationFromItems((itemSectionRenderer === null || itemSectionRenderer === void 0 ? void 0 : itemSectionRenderer.contents) || []);
26
- var chapters = (_d = (_c = (_b = data.response.playerOverlays.playerOverlayRenderer.decoratedPlayerBarRenderer) === null || _b === void 0 ? void 0 : _b.decoratedPlayerBarRenderer.playerBar) === null || _c === void 0 ? void 0 : _c.multiMarkersPlayerBarRenderer.markersMap) === null || _d === void 0 ? void 0 : _d[0].value.chapters;
31
+ var chapters = (_f = (_e = (_d = data.response.playerOverlays.playerOverlayRenderer.decoratedPlayerBarRenderer) === null || _d === void 0 ? void 0 : _d.decoratedPlayerBarRenderer.playerBar) === null || _e === void 0 ? void 0 : _e.multiMarkersPlayerBarRenderer.markersMap) === null || _f === void 0 ? void 0 : _f[0].value.chapters;
27
32
  target.chapters =
28
33
  (chapters === null || chapters === void 0 ? void 0 : chapters.map(function (_a) {
29
34
  var c = _a.chapterRenderer;
@@ -33,7 +38,7 @@ var VideoParser = /** @class */ (function () {
33
38
  thumbnails: new Thumbnails().load(c.thumbnail.thumbnails),
34
39
  });
35
40
  })) || [];
36
- var musicPanel = (_e = data.response.engagementPanels) === null || _e === void 0 ? void 0 : _e.find(function (e) { var _a, _b; return (_b = (_a = e.engagementPanelSectionListRenderer.content) === null || _a === void 0 ? void 0 : _a.structuredDescriptionContentRenderer) === null || _b === void 0 ? void 0 : _b.items.find(function (i) { var _a, _b; return ((_b = (_a = i.horizontalCardListRenderer) === null || _a === void 0 ? void 0 : _a.footerButton) === null || _b === void 0 ? void 0 : _b.buttonViewModel.iconName) === "MUSIC"; }); });
41
+ var musicPanel = (_g = data.response.engagementPanels) === null || _g === void 0 ? void 0 : _g.find(function (e) { var _a, _b; return (_b = (_a = e.engagementPanelSectionListRenderer.content) === null || _a === void 0 ? void 0 : _a.structuredDescriptionContentRenderer) === null || _b === void 0 ? void 0 : _b.items.find(function (i) { var _a, _b; return ((_b = (_a = i.horizontalCardListRenderer) === null || _a === void 0 ? void 0 : _a.footerButton) === null || _b === void 0 ? void 0 : _b.buttonViewModel.iconName) === "MUSIC"; }); });
37
42
  if (!musicPanel) {
38
43
  target.music = null;
39
44
  }
@@ -45,7 +50,7 @@ var VideoParser = /** @class */ (function () {
45
50
  imageUrl: music.image.sources[0].url,
46
51
  title: music.title,
47
52
  artist: music.subtitle,
48
- album: ((_f = music.secondarySubtitle) === null || _f === void 0 ? void 0 : _f.content) || null,
53
+ album: ((_h = music.secondarySubtitle) === null || _h === void 0 ? void 0 : _h.content) || null,
49
54
  };
50
55
  }
51
56
  // target.music =
@@ -1,5 +1,7 @@
1
+ import { Thumbnail } from "../shared";
1
2
  import { YoutubeRawData } from "./types";
2
3
  export declare const getDuration: (s: string) => number;
3
4
  export declare const stripToInt: (string: string) => number | null;
4
5
  export declare const getContinuationFromItems: (items: YoutubeRawData, accessors?: string[]) => string | undefined;
5
6
  export declare const mapFilter: (items: YoutubeRawData, key: string) => YoutubeRawData;
7
+ export declare const getThumbnailFromId: (id: string) => Thumbnail[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "youtubei",
3
- "version": "1.8.6",
3
+ "version": "1.8.8",
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",