@np-dev/youtubei-js
Version:
A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).
1,382 lines (1,338 loc) • 988 kB
JavaScript
/* eslint-disable */
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// node_modules/tslib/tslib.es6.mjs
function __rest(s, e) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
__name(__rest, "__rest");
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol")
name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
}
__name(__setFunctionName, "__setFunctionName");
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
__name(adopt, "adopt");
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
__name(fulfilled, "fulfilled");
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
__name(rejected, "rejected");
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
__name(step, "step");
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
__name(__awaiter, "__awaiter");
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m)
return m.call(o);
if (o && typeof o.length === "number")
return {
next: function() {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
__name(__values, "__values");
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
__name(__await, "__await");
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i;
function verb(n) {
if (g[n])
i[n] = function(v) {
return new Promise(function(a, b) {
q.push([n, v, a, b]) > 1 || resume(n, v);
});
};
}
__name(verb, "verb");
function resume(n, v) {
try {
step(g[n](v));
} catch (e) {
settle(q[0][3], e);
}
}
__name(resume, "resume");
function step(r) {
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
}
__name(step, "step");
function fulfill(value) {
resume("next", value);
}
__name(fulfill, "fulfill");
function reject(value) {
resume("throw", value);
}
__name(reject, "reject");
function settle(f, v) {
if (f(v), q.shift(), q.length)
resume(q[0][0], q[0][1]);
}
__name(settle, "settle");
}
__name(__asyncGenerator, "__asyncGenerator");
function __asyncValues(o) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i);
function verb(n) {
i[n] = o[n] && function(v) {
return new Promise(function(resolve, reject) {
v = o[n](v), settle(resolve, reject, v.done, v.value);
});
};
}
__name(verb, "verb");
function settle(resolve, reject, d, v) {
Promise.resolve(v).then(function(v2) {
resolve({ value: v2, done: d });
}, reject);
}
__name(settle, "settle");
}
__name(__asyncValues, "__asyncValues");
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot write private member to an object whose class did not declare it");
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
}
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
// dist/src/utils/Utils.js
var Utils_exports = {};
__export(Utils_exports, {
ChannelError: () => ChannelError,
InnertubeError: () => InnertubeError,
MissingParamError: () => MissingParamError,
OAuthError: () => OAuthError,
ParsingError: () => ParsingError,
Platform: () => Platform,
PlayerError: () => PlayerError,
SessionError: () => SessionError,
base64ToU8: () => base64ToU8,
concatMemos: () => concatMemos,
debugFetch: () => debugFetch,
deepCompare: () => deepCompare,
escapeStringRegexp: () => escapeStringRegexp,
generateRandomString: () => generateRandomString,
generateSidAuth: () => generateSidAuth,
getRandomUserAgent: () => getRandomUserAgent,
getStringBetweenStrings: () => getStringBetweenStrings,
hasKeys: () => hasKeys,
isTextRun: () => isTextRun,
streamToIterable: () => streamToIterable,
throwIfMissing: () => throwIfMissing,
timeToSeconds: () => timeToSeconds,
u8ToBase64: () => u8ToBase64
});
// dist/src/parser/helpers.js
var helpers_exports = {};
__export(helpers_exports, {
Maybe: () => Maybe,
Memo: () => Memo,
SuperParsedResult: () => SuperParsedResult,
YTNode: () => YTNode,
observe: () => observe
});
var _YTNode_instances;
var _YTNode_is;
var _Maybe_instances;
var _Maybe_value;
var _Maybe_checkPrimative;
var _Maybe_assertPrimative;
var _SuperParsedResult_result;
var isObserved = Symbol("ObservedArray.isObserved");
var YTNode = class {
constructor() {
_YTNode_instances.add(this);
this.type = this.constructor.type;
}
is(...types2) {
return types2.some((type) => __classPrivateFieldGet(this, _YTNode_instances, "m", _YTNode_is).call(this, type));
}
as(...types2) {
if (!this.is(...types2)) {
throw new ParsingError(`Cannot cast ${this.type} to one of ${types2.map((t) => t.type).join(", ")}`);
}
return this;
}
hasKey(key) {
return Reflect.has(this, key);
}
key(key) {
if (!this.hasKey(key)) {
throw new ParsingError(`Missing key ${key}`);
}
return new Maybe(this[key]);
}
};
__name(YTNode, "YTNode");
_YTNode_instances = /* @__PURE__ */ new WeakSet(), _YTNode_is = /* @__PURE__ */ __name(function _YTNode_is2(type) {
return this.type === type.type;
}, "_YTNode_is");
YTNode.type = "YTNode";
var Maybe = class {
constructor(value) {
_Maybe_instances.add(this);
_Maybe_value.set(this, void 0);
__classPrivateFieldSet(this, _Maybe_value, value, "f");
}
get typeof() {
return typeof __classPrivateFieldGet(this, _Maybe_value, "f");
}
string() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "string");
}
isString() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "string");
}
number() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "number");
}
isNumber() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "number");
}
bigint() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "bigint");
}
isBigint() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "bigint");
}
boolean() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "boolean");
}
isBoolean() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "boolean");
}
symbol() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "symbol");
}
isSymbol() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "symbol");
}
undefined() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "undefined");
}
isUndefined() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "undefined");
}
null() {
if (__classPrivateFieldGet(this, _Maybe_value, "f") !== null)
throw new TypeError(`Expected null, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isNull() {
return __classPrivateFieldGet(this, _Maybe_value, "f") === null;
}
object() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "object");
}
isObject() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "object");
}
function() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimative).call(this, "function");
}
isFunction() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, "function");
}
array() {
if (!Array.isArray(__classPrivateFieldGet(this, _Maybe_value, "f"))) {
throw new TypeError(`Expected array, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
arrayOfMaybe() {
const arrayProps = [];
return new Proxy(this.array(), {
get(target, prop) {
if (Reflect.has(arrayProps, prop)) {
return Reflect.get(target, prop);
}
return new Maybe(Reflect.get(target, prop));
}
});
}
isArray() {
return Array.isArray(__classPrivateFieldGet(this, _Maybe_value, "f"));
}
node() {
if (!(__classPrivateFieldGet(this, _Maybe_value, "f") instanceof YTNode)) {
throw new TypeError(`Expected YTNode, got ${__classPrivateFieldGet(this, _Maybe_value, "f").constructor.name}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isNode() {
return __classPrivateFieldGet(this, _Maybe_value, "f") instanceof YTNode;
}
nodeOfType(...types2) {
return this.node().as(...types2);
}
isNodeOfType(...types2) {
return this.isNode() && this.node().is(...types2);
}
observed() {
if (!this.isObserved()) {
throw new TypeError(`Expected ObservedArray, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isObserved() {
var _a3;
return (_a3 = __classPrivateFieldGet(this, _Maybe_value, "f")) === null || _a3 === void 0 ? void 0 : _a3[isObserved];
}
parsed() {
if (!(__classPrivateFieldGet(this, _Maybe_value, "f") instanceof SuperParsedResult)) {
throw new TypeError(`Expected SuperParsedResult, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isParsed() {
return __classPrivateFieldGet(this, _Maybe_value, "f") instanceof SuperParsedResult;
}
any() {
console.warn("This call is not meant to be used outside of debugging. Please use the specific type getter instead.");
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
instanceof(type) {
if (!this.isInstanceof(type)) {
throw new TypeError(`Expected instance of ${type.name}, got ${__classPrivateFieldGet(this, _Maybe_value, "f").constructor.name}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isInstanceof(type) {
return __classPrivateFieldGet(this, _Maybe_value, "f") instanceof type;
}
};
__name(Maybe, "Maybe");
_Maybe_value = /* @__PURE__ */ new WeakMap(), _Maybe_instances = /* @__PURE__ */ new WeakSet(), _Maybe_checkPrimative = /* @__PURE__ */ __name(function _Maybe_checkPrimative2(type) {
if (typeof __classPrivateFieldGet(this, _Maybe_value, "f") !== type) {
return false;
}
return true;
}, "_Maybe_checkPrimative"), _Maybe_assertPrimative = /* @__PURE__ */ __name(function _Maybe_assertPrimative2(type) {
if (!__classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimative).call(this, type)) {
throw new TypeError(`Expected ${type}, got ${this.typeof}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}, "_Maybe_assertPrimative");
var SuperParsedResult = class {
constructor(result) {
_SuperParsedResult_result.set(this, void 0);
__classPrivateFieldSet(this, _SuperParsedResult_result, result, "f");
}
get is_null() {
return __classPrivateFieldGet(this, _SuperParsedResult_result, "f") === null;
}
get is_array() {
return !this.is_null && Array.isArray(__classPrivateFieldGet(this, _SuperParsedResult_result, "f"));
}
get is_node() {
return !this.is_array;
}
array() {
if (!this.is_array) {
throw new TypeError("Expected an array, got a node");
}
return __classPrivateFieldGet(this, _SuperParsedResult_result, "f");
}
item() {
if (!this.is_node) {
throw new TypeError("Expected a node, got an array");
}
return __classPrivateFieldGet(this, _SuperParsedResult_result, "f");
}
};
__name(SuperParsedResult, "SuperParsedResult");
_SuperParsedResult_result = /* @__PURE__ */ new WeakMap();
function observe(obj) {
return new Proxy(obj, {
get(target, prop) {
if (prop == "get") {
return (rule, del_item) => target.find((obj2, index) => {
const match = deepCompare(rule, obj2);
if (match && del_item) {
target.splice(index, 1);
}
return match;
});
}
if (prop == isObserved) {
return true;
}
if (prop == "getAll") {
return (rule, del_items) => target.filter((obj2, index) => {
const match = deepCompare(rule, obj2);
if (match && del_items) {
target.splice(index, 1);
}
return match;
});
}
if (prop == "matchCondition") {
return (condition) => target.find((obj2) => {
return condition(obj2);
});
}
if (prop == "filterType") {
return (...types2) => {
return observe(target.filter((node) => {
if (node.is(...types2))
return true;
return false;
}));
};
}
if (prop == "firstOfType") {
return (...types2) => {
return target.find((node) => {
if (node.is(...types2))
return true;
return false;
});
};
}
if (prop == "first") {
return () => target[0];
}
if (prop == "as") {
return (...types2) => {
return observe(target.map((node) => {
if (node.is(...types2))
return node;
throw new ParsingError(`Expected node of any type ${types2.map((type) => type.type).join(", ")}, got ${node.type}`);
}));
};
}
if (prop == "remove") {
return (index) => target.splice(index, 1);
}
return Reflect.get(target, prop);
}
});
}
__name(observe, "observe");
var Memo = class extends Map {
getType(...types2) {
types2 = types2.flat();
return observe(types2.flatMap((type) => this.get(type.type) || []));
}
};
__name(Memo, "Memo");
// dist/src/parser/misc.js
var misc_exports = {};
__export(misc_exports, {
Author: () => Author,
ChildElement: () => ChildElement_default,
EmojiRun: () => EmojiRun,
Format: () => Format_default,
Text: () => Text2,
TextRun: () => TextRun,
Thumbnail: () => Thumbnail,
VideoDetails: () => VideoDetails
});
// dist/src/utils/Constants.js
var Constants_exports = {};
__export(Constants_exports, {
CLIENTS: () => CLIENTS,
INNERTUBE_HEADERS_BASE: () => INNERTUBE_HEADERS_BASE,
OAUTH: () => OAUTH,
STREAM_HEADERS: () => STREAM_HEADERS,
URLS: () => URLS
});
var URLS = Object.freeze({
YT_BASE: "https://www.youtube.com",
YT_MUSIC_BASE: "https://music.youtube.com",
YT_SUGGESTIONS: "https://suggestqueries.google.com/complete/",
YT_UPLOAD: "https://upload.youtube.com/",
API: Object.freeze({
BASE: "https://youtubei.googleapis.com",
PRODUCTION_1: "https://www.youtube.com/youtubei/",
PRODUCTION_2: "https://youtubei.googleapis.com/youtubei/",
STAGING: "https://green-youtubei.sandbox.googleapis.com/youtubei/",
RELEASE: "https://release-youtubei.sandbox.googleapis.com/youtubei/",
TEST: "https://test-youtubei.sandbox.googleapis.com/youtubei/",
CAMI: "http://cami-youtubei.sandbox.googleapis.com/youtubei/",
UYTFE: "https://uytfe.sandbox.google.com/youtubei/"
})
});
var OAUTH = Object.freeze({
SCOPE: "http://gdata.youtube.com https://www.googleapis.com/auth/youtube-paid-content",
GRANT_TYPE: "http://oauth.net/grant_type/device/1.0",
MODEL_NAME: "ytlr::",
HEADERS: Object.freeze({
"accept": "*/*",
"origin": "https://www.youtube.com",
"user-agent": "Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version",
"content-type": "application/json",
"referer": "https://www.youtube.com/tv",
"accept-language": "en-US"
}),
REGEX: Object.freeze({
AUTH_SCRIPT: /<script id="base-js" src="(.*?)" nonce=".*?"><\/script>/,
CLIENT_IDENTITY: new RegExp('var .+?={clientId:"(?<client_id>.+?)",.+?:"(?<client_secret>.+?)".+?}')
})
});
var CLIENTS = Object.freeze({
iOS: {
NAME: "iOS",
VERSION: "18.06.35",
USER_AGENT: "com.google.ios.youtube/18.06.35 (iPhone; CPU iPhone OS 14_4 like Mac OS X; en_US)",
DEVICE_MODEL: "iPhone10,6"
},
WEB: {
NAME: "WEB",
VERSION: "2.20230622.06.00",
API_KEY: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
API_VERSION: "v1",
STATIC_VISITOR_ID: "6zpwvWUNAco"
},
WEB_KIDS: {
NAME: "WEB_KIDS",
VERSION: "2.20230111.00.00"
},
YTMUSIC: {
NAME: "WEB_REMIX",
VERSION: "1.20211213.00.00"
},
ANDROID: {
NAME: "ANDROID",
VERSION: "18.06.35",
SDK_VERSION: "29",
USER_AGENT: "com.google.android.youtube/18.06.35 (Linux; U; Android 10; US)"
},
YTSTUDIO_ANDROID: {
NAME: "ANDROID_CREATOR",
VERSION: "22.43.101"
},
YTMUSIC_ANDROID: {
NAME: "ANDROID_MUSIC",
VERSION: "5.34.51"
},
TV_EMBEDDED: {
NAME: "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
VERSION: "2.0"
}
});
var STREAM_HEADERS = Object.freeze({
"accept": "*/*",
"origin": "https://www.youtube.com",
"referer": "https://www.youtube.com",
"DNT": "?1"
});
var INNERTUBE_HEADERS_BASE = Object.freeze({
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"content-type": "application/json"
});
// dist/src/parser/parser.js
var parser_exports = {};
__export(parser_exports, {
addRuntimeParser: () => addRuntimeParser,
applyMutations: () => applyMutations,
getDynamicParsers: () => getDynamicParsers,
getParserByName: () => getParserByName,
hasParser: () => hasParser,
parse: () => parse,
parseActions: () => parseActions,
parseArray: () => parseArray,
parseC: () => parseC,
parseFormats: () => parseFormats,
parseItem: () => parseItem,
parseLC: () => parseLC,
parseRR: () => parseRR,
parseResponse: () => parseResponse,
sanitizeClassName: () => sanitizeClassName,
setParserErrorHandler: () => setParserErrorHandler,
shouldIgnore: () => shouldIgnore
});
// dist/src/parser/classes/AudioOnlyPlayability.js
var AudioOnlyPlayability = class extends YTNode {
constructor(data2) {
super();
this.audio_only_availability = data2.audioOnlyAvailability;
}
};
__name(AudioOnlyPlayability, "AudioOnlyPlayability");
AudioOnlyPlayability.type = "AudioOnlyPlayability";
var AudioOnlyPlayability_default = AudioOnlyPlayability;
// dist/src/parser/classes/Button.js
var Button = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "text"))
this.text = new Text2(data2.text).toString();
if (Reflect.has(data2, "accessibility") && Reflect.has(data2.accessibility, "label"))
this.label = data2.accessibility.label;
if (Reflect.has(data2, "tooltip"))
this.tooltip = data2.tooltip;
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType"))
this.icon_type = data2.icon.iconType;
if (Reflect.has(data2, "isDisabled"))
this.is_disabled = data2.isDisabled;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint || data2.serviceEndpoint || data2.command);
}
};
__name(Button, "Button");
Button.type = "Button";
var Button_default = Button;
// dist/src/parser/classes/DropdownItem.js
var DropdownItem = class extends YTNode {
constructor(data2) {
var _a3;
super();
this.label = new Text2(data2.label).toString();
this.selected = !!data2.isSelected;
if (Reflect.has(data2, "int32Value")) {
this.value = data2.int32Value;
} else if (data2.stringValue) {
this.value = data2.stringValue;
}
if (Reflect.has(data2, "onSelectCommand")) {
this.endpoint = new NavigationEndpoint_default(data2.onSelectCommand);
}
if (Reflect.has(data2, "icon")) {
this.icon_type = (_a3 = data2.icon) === null || _a3 === void 0 ? void 0 : _a3.iconType;
}
if (Reflect.has(data2, "descriptionText")) {
this.description = new Text2(data2.descriptionText);
}
}
};
__name(DropdownItem, "DropdownItem");
DropdownItem.type = "DropdownItem";
var DropdownItem_default = DropdownItem;
// dist/src/parser/classes/Dropdown.js
var Dropdown = class extends YTNode {
constructor(data2) {
super();
this.label = data2.label || "";
this.entries = parser_exports.parseArray(data2.entries, DropdownItem_default);
}
};
__name(Dropdown, "Dropdown");
Dropdown.type = "Dropdown";
var Dropdown_default = Dropdown;
// dist/src/parser/classes/CreatePlaylistDialog.js
var CreatePlaylistDialog = class extends YTNode {
constructor(data2) {
super();
this.title = new Text2(data2.dialogTitle).toString();
this.title_placeholder = data2.titlePlaceholder || "";
this.privacy_option = parser_exports.parseItem(data2.privacyOption, Dropdown_default);
this.create_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
}
};
__name(CreatePlaylistDialog, "CreatePlaylistDialog");
CreatePlaylistDialog.type = "CreatePlaylistDialog";
var CreatePlaylistDialog_default = CreatePlaylistDialog;
// dist/src/parser/classes/actions/OpenPopupAction.js
var OpenPopupAction = class extends YTNode {
constructor(data2) {
super();
this.popup = parser_exports.parseItem(data2.popup);
this.popup_type = data2.popupType;
}
};
__name(OpenPopupAction, "OpenPopupAction");
OpenPopupAction.type = "OpenPopupAction";
var OpenPopupAction_default = OpenPopupAction;
// dist/src/parser/classes/NavigationEndpoint.js
var NavigationEndpoint = class extends YTNode {
constructor(data2) {
var _a3, _b, _c, _d, _e, _f, _g, _h;
super();
if (Reflect.has(data2 || {}, "innertubeCommand"))
data2 = data2.innertubeCommand;
if (Reflect.has(data2 || {}, "openPopupAction"))
this.open_popup = new OpenPopupAction_default(data2.openPopupAction);
const name = Object.keys(data2 || {}).find((item) => item.endsWith("Endpoint") || item.endsWith("Command"));
this.payload = name ? Reflect.get(data2, name) : {};
if (Reflect.has(this.payload, "dialog") || Reflect.has(this.payload, "content")) {
this.dialog = parser_exports.parseItem(this.payload.dialog || this.payload.content);
}
if (data2 === null || data2 === void 0 ? void 0 : data2.serviceEndpoint) {
data2 = data2.serviceEndpoint;
}
this.metadata = {};
if ((_b = (_a3 = data2 === null || data2 === void 0 ? void 0 : data2.commandMetadata) === null || _a3 === void 0 ? void 0 : _a3.webCommandMetadata) === null || _b === void 0 ? void 0 : _b.url) {
this.metadata.url = data2.commandMetadata.webCommandMetadata.url;
}
if ((_d = (_c = data2 === null || data2 === void 0 ? void 0 : data2.commandMetadata) === null || _c === void 0 ? void 0 : _c.webCommandMetadata) === null || _d === void 0 ? void 0 : _d.webPageType) {
this.metadata.page_type = data2.commandMetadata.webCommandMetadata.webPageType;
}
if ((_f = (_e = data2 === null || data2 === void 0 ? void 0 : data2.commandMetadata) === null || _e === void 0 ? void 0 : _e.webCommandMetadata) === null || _f === void 0 ? void 0 : _f.apiUrl) {
this.metadata.api_url = data2.commandMetadata.webCommandMetadata.apiUrl.replace("/youtubei/v1/", "");
} else if (name) {
this.metadata.api_url = this.getEndpoint(name);
}
if ((_h = (_g = data2 === null || data2 === void 0 ? void 0 : data2.commandMetadata) === null || _g === void 0 ? void 0 : _g.webCommandMetadata) === null || _h === void 0 ? void 0 : _h.sendPost) {
this.metadata.send_post = data2.commandMetadata.webCommandMetadata.sendPost;
}
if (data2 === null || data2 === void 0 ? void 0 : data2.createPlaylistEndpoint) {
if (data2 === null || data2 === void 0 ? void 0 : data2.createPlaylistEndpoint.createPlaylistDialog) {
this.dialog = parser_exports.parseItem(data2 === null || data2 === void 0 ? void 0 : data2.createPlaylistEndpoint.createPlaylistDialog, CreatePlaylistDialog_default);
}
}
}
getEndpoint(name) {
switch (name) {
case "browseEndpoint":
return "/browse";
case "watchEndpoint":
return "/player";
case "searchEndpoint":
return "/search";
case "watchPlaylistEndpoint":
return "/next";
case "liveChatItemContextMenuEndpoint":
return "live_chat/get_item_context_menu";
}
}
call(actions, args) {
if (!actions)
throw new Error("An active caller must be provided");
if (!this.metadata.api_url)
throw new Error("Expected an api_url, but none was found, this is a bug.");
return actions.execute(this.metadata.api_url, Object.assign(Object.assign({}, this.payload), args));
}
toURL() {
if (!this.metadata.url)
return void 0;
if (!this.metadata.page_type)
return void 0;
return this.metadata.page_type === "WEB_PAGE_TYPE_UNKNOWN" ? this.metadata.url : `https://www.youtube.com${this.metadata.url}`;
}
};
__name(NavigationEndpoint, "NavigationEndpoint");
NavigationEndpoint.type = "NavigationEndpoint";
var NavigationEndpoint_default = NavigationEndpoint;
// dist/src/parser/classes/misc/Thumbnail.js
var Thumbnail = class {
constructor(data2) {
this.url = data2.url;
this.width = data2.width;
this.height = data2.height;
}
static fromResponse(data2) {
if (!data2 || !data2.thumbnails)
return [];
return data2.thumbnails.map((x) => new Thumbnail(x)).sort((a, b) => b.width - a.width);
}
};
__name(Thumbnail, "Thumbnail");
// dist/src/parser/classes/misc/EmojiRun.js
var EmojiRun = class {
constructor(data2) {
var _a3, _b, _c, _d, _e, _f;
this.text = ((_a3 = data2.emoji) === null || _a3 === void 0 ? void 0 : _a3.emojiId) || ((_c = (_b = data2.emoji) === null || _b === void 0 ? void 0 : _b.shortcuts) === null || _c === void 0 ? void 0 : _c[0]) || "";
this.emoji = {
emoji_id: data2.emoji.emojiId,
shortcuts: ((_d = data2.emoji) === null || _d === void 0 ? void 0 : _d.shortcuts) || [],
search_terms: ((_e = data2.emoji) === null || _e === void 0 ? void 0 : _e.searchTerms) || [],
image: Thumbnail.fromResponse(data2.emoji.image),
is_custom: !!((_f = data2.emoji) === null || _f === void 0 ? void 0 : _f.isCustomEmoji)
};
}
toString() {
return this.text;
}
toHTML() {
const escaped_text = escape(this.text);
return `<img src="${this.emoji.image[0].url}" alt="${escaped_text}" title="${escaped_text}" style="display: inline-block; vertical-align: text-top; height: var(--yt-emoji-size, 1rem); width: var(--yt-emoji-size, 1rem);" loading="lazy" crossorigin="anonymous" />`;
}
};
__name(EmojiRun, "EmojiRun");
// dist/src/parser/classes/misc/TextRun.js
var TextRun = class {
constructor(data2) {
this.text = data2.text;
this.bold = Boolean(data2.bold);
this.italics = Boolean(data2.italics);
this.strikethrough = Boolean(data2.strikethrough);
if (Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
this.attachment = data2.attachment;
}
toString() {
return this.text;
}
toHTML() {
const tags = [];
if (this.bold)
tags.push("b");
if (this.italics)
tags.push("i");
if (this.strikethrough)
tags.push("s");
const escaped_text = escape(this.text);
const styled_text = tags.map((tag) => `<${tag}>`).join("") + escaped_text + tags.map((tag) => `</${tag}>`).join("");
const wrapped_text = `<span style="white-space: pre-wrap;">${styled_text}</span>`;
if (this.attachment) {
if (this.attachment.element.type.imageType.image.sources.length) {
const { url } = this.attachment.element.type.imageType.image.sources[0];
if (this.endpoint) {
const nav_url = this.endpoint.toURL();
if (nav_url)
return `<a href="${nav_url}" class="yt-ch-link" display: block; width: fit-content; font-size: small;><img src="${url}" style="vertical-align: middle; height: ${this.attachment.element.properties.layoutProperties.height.value}px; width: ${this.attachment.element.properties.layoutProperties.width.value}px;">${wrapped_text}</a>`;
}
}
}
if (this.endpoint) {
const url = this.endpoint.toURL();
if (url)
return `<a href="${url}">${wrapped_text}</a>`;
}
return wrapped_text;
}
};
__name(TextRun, "TextRun");
// dist/src/parser/classes/misc/Text.js
function escape(text) {
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
}
__name(escape, "escape");
var Text2 = class {
constructor(data2) {
var _a3, _b, _c, _d;
if (typeof data2 === "object" && data2 !== null && Reflect.has(data2, "runs") && Array.isArray(data2.runs)) {
this.runs = data2.runs.map((run) => run.emoji ? new EmojiRun(run) : new TextRun(run));
this.text = this.runs.map((run) => run.text).join("");
} else {
this.text = data2 === null || data2 === void 0 ? void 0 : data2.simpleText;
}
if (typeof data2 === "object" && data2 !== null && Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
if (typeof data2 === "object" && data2 !== null && Reflect.has(data2, "titleNavigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.titleNavigationEndpoint);
}
if (!this.endpoint) {
if ((_b = (_a3 = this.runs) === null || _a3 === void 0 ? void 0 : _a3[0]) === null || _b === void 0 ? void 0 : _b.endpoint) {
this.endpoint = (_d = (_c = this.runs) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.endpoint;
}
}
}
static fromAttributed(data2) {
const runs = [];
const content = data2.content;
const command_runs = data2.commandRuns;
let last_end_index = 0;
if (command_runs) {
for (const item of command_runs) {
const length = item.length;
const start_index = item.startIndex;
if (start_index > last_end_index) {
runs.push({
text: content.slice(last_end_index, start_index)
});
}
if (Reflect.has(item, "onTap")) {
let attachment = null;
if (Reflect.has(data2, "attachmentRuns")) {
const attachment_runs = data2.attachmentRuns;
for (const attatchment_run of attachment_runs) {
if (attatchment_run.startIndex - 2 == start_index) {
attachment = attatchment_run;
break;
}
}
}
if (attachment) {
runs.push({
text: content.slice(start_index, start_index + length),
navigationEndpoint: item.onTap,
attachment
});
} else {
runs.push({
text: content.slice(start_index, start_index + length),
navigationEndpoint: item.onTap
});
}
}
last_end_index = start_index + length;
}
if (last_end_index < content.length) {
runs.push({
text: content.slice(last_end_index)
});
}
} else {
runs.push({
text: content
});
}
return new Text2({ runs });
}
toHTML() {
return this.runs ? this.runs.map((run) => run.toHTML()).join("") : this.text;
}
isEmpty() {
return this.text === void 0;
}
toString() {
return this.text || "N/A";
}
};
__name(Text2, "Text");
// dist/src/parser/classes/CardCollection.js
var CardCollection = class extends YTNode {
constructor(data2) {
super();
this.cards = parser_exports.parseArray(data2.cards);
this.header = new Text2(data2.headerText);
this.allow_teaser_dismiss = data2.allowTeaserDismiss;
}
};
__name(CardCollection, "CardCollection");
CardCollection.type = "CardCollection";
var CardCollection_default = CardCollection;
// dist/src/parser/classes/Endscreen.js
var Endscreen = class extends YTNode {
constructor(data2) {
super();
this.elements = parser_exports.parseArray(data2.elements);
this.start_ms = data2.startMs;
}
};
__name(Endscreen, "Endscreen");
Endscreen.type = "Endscreen";
var Endscreen_default = Endscreen;
// dist/src/parser/classes/PlayerAnnotationsExpanded.js
var PlayerAnnotationsExpanded = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "featuredChannel")) {
this.featured_channel = {
start_time_ms: data2.featuredChannel.startTimeMs,
end_time_ms: data2.featuredChannel.endTimeMs,
watermark: Thumbnail.fromResponse(data2.featuredChannel.watermark),
channel_name: data2.featuredChannel.channelName,
endpoint: new NavigationEndpoint_default(data2.featuredChannel.navigationEndpoint),
subscribe_button: parser_exports.parseItem(data2.featuredChannel.subscribeButton)
};
}
this.allow_swipe_dismiss = data2.allowSwipeDismiss;
this.annotation_id = data2.annotationId;
}
};
__name(PlayerAnnotationsExpanded, "PlayerAnnotationsExpanded");
PlayerAnnotationsExpanded.type = "PlayerAnnotationsExpanded";
var PlayerAnnotationsExpanded_default = PlayerAnnotationsExpanded;
// dist/src/parser/classes/PlayerCaptionsTracklist.js
var PlayerCaptionsTracklist = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "captionTracks")) {
this.caption_tracks = data2.captionTracks.map((ct) => ({
base_url: ct.baseUrl,
name: new Text2(ct.name),
vss_id: ct.vssId,
language_code: ct.languageCode,
kind: ct.kind,
is_translatable: ct.isTranslatable
}));
}
if (Reflect.has(data2, "audioTracks")) {
this.audio_tracks = data2.audioTracks.map((at2) => ({
audio_track_id: at2.audioTrackId,
captions_initial_state: at2.captionsInitialState,
default_caption_track_index: at2.defaultCaptionTrackIndex,
has_default_track: at2.hasDefaultTrack,
visibility: at2.visibility,
caption_track_indices: at2.captionTrackIndices
}));
}
if (Reflect.has(data2, "defaultAudioTrackIndex")) {
this.default_audio_track_index = data2.defaultAudioTrackIndex;
}
if (Reflect.has(data2, "translationLanguages")) {
this.translation_languages = data2.translationLanguages.map((tl) => ({
language_code: tl.languageCode,
language_name: new Text2(tl.languageName)
}));
}
}
};
__name(PlayerCaptionsTracklist, "PlayerCaptionsTracklist");
PlayerCaptionsTracklist.type = "PlayerCaptionsTracklist";
var PlayerCaptionsTracklist_default = PlayerCaptionsTracklist;
// dist/src/parser/classes/PlayerLiveStoryboardSpec.js
var PlayerLiveStoryboardSpec = class extends YTNode {
constructor() {
super();
}
};
__name(PlayerLiveStoryboardSpec, "PlayerLiveStoryboardSpec");
PlayerLiveStoryboardSpec.type = "PlayerLiveStoryboardSpec";
var PlayerLiveStoryboardSpec_default = PlayerLiveStoryboardSpec;
// dist/src/parser/classes/PlayerStoryboardSpec.js
var PlayerStoryboardSpec = class extends YTNode {
constructor(data2) {
super();
const parts = data2.spec.split("|");
const url = new URL(parts.shift());
this.boards = parts.map((part, i) => {
const [thumbnail_width, thumbnail_height, thumbnail_count, columns, rows, interval, name, sigh] = part.split("#");
url.searchParams.set("sigh", sigh);
const storyboard_count = Math.ceil(parseInt(thumbnail_count, 10) / (parseInt(columns, 10) * parseInt(rows, 10)));
return {
template_url: url.toString().replace("$L", i).replace("$N", name),
thumbnail_width: parseInt(thumbnail_width, 10),
thumbnail_height: parseInt(thumbnail_height, 10),
thumbnail_count: parseInt(thumbnail_count, 10),
interval: parseInt(interval, 10),
columns: parseInt(columns, 10),
rows: parseInt(rows, 10),
storyboard_count
};
});
}
};
__name(PlayerStoryboardSpec, "PlayerStoryboardSpec");
PlayerStoryboardSpec.type = "PlayerStoryboardSpec";
var PlayerStoryboardSpec_default = PlayerStoryboardSpec;
// dist/src/parser/classes/Alert.js
var Alert = class extends YTNode {
constructor(data2) {
super();
this.text = new Text2(data2.text);
this.alert_type = data2.type;
}
};
__name(Alert, "Alert");
Alert.type = "Alert";
var Alert_default = Alert;
// dist/src/parser/classes/AlertWithButton.js
var AlertWithButton = class extends YTNode {
constructor(data2) {
super();
this.text = new Text2(data2.text);
this.alert_type = data2.type;
this.dismiss_button = parser_exports.parseItem(data2.dismissButton, Button_default);
}
};
__name(AlertWithButton, "AlertWithButton");
AlertWithButton.type = "AlertWithButton";
var AlertWithButton_default = AlertWithButton;
// dist/src/parser/classes/ClipCreationTextInput.js
var ClipCreationTextInput = class extends YTNode {
constructor(data2) {
super();
this.placeholder_text = new Text2(data2.placeholderText);
this.max_character_limit = data2.maxCharacterLimit;
}
};
__name(ClipCreationTextInput, "ClipCreationTextInput");
ClipCreationTextInput.type = "ClipCreationTextInput";
var ClipCreationTextInput_default = ClipCreationTextInput;
// dist/src/parser/classes/ClipCreationScrubber.js
var ClipCreationScrubber = class extends YTNode {
constructor(data2) {
var _a3, _b, _c, _d, _e, _f;
super();
this.length_template = data2.lengthTemplate;
this.max_length_ms = data2.maxLengthMs;
this.min_length_ms = data2.minLengthMs;
this.default_length_ms = data2.defaultLengthMs;
this.window_size_ms = data2.windowSizeMs;
this.start_label = (_b = (_a3 = data2.startAccessibility) === null || _a3 === void 0 ? void 0 : _a3.accessibilityData) === null || _b === void 0 ? void 0 : _b.label;
this.end_label = (_d = (_c = data2.endAccessibility) === null || _c === void 0 ? void 0 : _c.accessibilityData) === null || _d === void 0 ? void 0 : _d.label;
this.duration_label = (_f = (_e = data2.durationAccessibility) === null || _e === void 0 ? void 0 : _e.accessibilityData) === null || _f === void 0 ? void 0 : _f.label;
}
};
__name(ClipCreationScrubber, "ClipCreationScrubber");
ClipCreationScrubber.type = "ClipCreationScrubber";
var ClipCreationScrubber_default = ClipCreationScrubber;
// dist/src/parser/classes/ClipAdState.js
var ClipAdState = class extends YTNode {
constructor(data2) {
super();
this.title = new Text2(data2.title);
this.body = new Text2(data2.body);
}
};
__name(ClipAdState, "ClipAdState");
ClipAdState.type = "ClipAdState";
var ClipAdState_default = ClipAdState;
// dist/src/parser/classes/ClipCreation.js
var ClipCreation = class extends YTNode {
constructor(data2) {
super();
this.user_avatar = Thumbnail.fromResponse(data2.userAvatar);
this.title_input = parser_exports.parseItem(data2.titleInput, [ClipCreationTextInput_default]);
this.scrubber = parser_exports.parseItem(data2.scrubber, [ClipCreationScrubber_default]);
this.save_button = parser_exports.parseItem(data2.saveButton, [Button_default]);
this.display_name = new Text2(data2.displayName);
this.publicity_label = data2.publicityLabel;
this.cancel_button = parser_exports.parseItem(data2.cancelButton, [Button_default]);
this.ad_state_overlay = parser_exports.parseItem(data2.adStateOverlay, [ClipAdState_default]);
this.external_video_id = data2.externalVideoId;
this.publicity_label_icon = data2.publicityLabelIcon;
}
};
__name(ClipCreation, "ClipCreation");
ClipCreation.type = "ClipCreation";
var ClipCreation_default = ClipCreation;
// dist/src/parser/classes/ClipSection.js
var ClipSection = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parse(data2.contents, true, [ClipCreation_default]);
}
};
__name(ClipSection, "ClipSection");
ClipSection.type = "ClipSection";
var ClipSection_default = ClipSection;
// dist/src/parser/classes/ContinuationItem.js
var ContinuationItem = class extends YTNode {
constructor(data2) {
super();
this.trigger = data2.trigger;
if (Reflect.has(data2, "button")) {
this.button = parser_exports.parseItem(data2.button, Button_default);
}
this.endpoint = new NavigationEndpoint_default(data2.continuationEndpoint);
}
};
__name(ContinuationItem, "ContinuationItem");
ContinuationItem.type = "ContinuationItem";
var ContinuationItem_default = ContinuationItem;
// dist/src/parser/classes/EngagementPanelTitleHeader.js
var EngagementPanelTitleHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text2(data2.title);
this.visibility_button = parser_exports.parseItem(data2.visibilityButton, Button_default);
}
};
__name(EngagementPanelTitleHeader, "EngagementPanelTitleHeader");
EngagementPanelTitleHeader.type = "EngagementPanelTitleHeader";
var EngagementPanelTitleHeader_default = EngagementPanelTitleHeader;
// dist/src/parser/classes/menus/Menu.js
var Menu = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
this.top_level_buttons = parser_exports.parseArray(data2.topLevelButtons);
if (Reflect.has(data2, "accessibility") && Reflect.has(data2.accessibility, "accessibilityData")) {
this.label = data2.accessibility.accessibilityData.label;
}
}
get contents() {
return this.items;
}
};
__name(Menu, "Menu");
Menu.type = "Menu";
var Menu_default = Menu;
// dist/src/parser/classes/MacroMarkersInfoItem.js
var MacroMarkersInfoItem = class extends YTNode {
constructor(data2) {
super();
this.info_text = new Text2(data2.infoText);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(MacroMarkersInfoItem, "MacroMarkersInfoItem");
MacroMarkersInfoItem.type = "MacroMarkersInfoItem";
var MacroMarkersInfoItem_default = MacroMarkersInfoItem;
// dist/src/parser/classes/MacroMarkersListItem.js
var MacroMarkersListItem = class extends YTNode {
constructor(data2) {
super();
this.title = new Text2(data2.title);
this.time_description = new Text2(data2.timeDescription);
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.on_tap_endpoint = new NavigationEndpoint_default(data2.onTap);
this.layout = data2.layout;
this.is_highlighted = !!data2.isHighlighted;
}
};
__name(MacroMarkersListItem, "MacroMarkersListItem");
MacroMarkersListItem.type = "MacroMarkersListItem";
var MacroMarkersListItem_default = MacroMarkersListItem;
// dist/src/parser/classes/MacroMarkersList.js
var MacroMarkersList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents, [MacroMarkersInfoItem_default, MacroMarkersListItem_default]);
this.sync_button_label = new Text2(data2.syncButtonLabel);
}
};
__name(MacroMarkersList, "MacroMarkersList");
MacroMarkersList.type = "MacroMarkersList";
var MacroMarkersList_default = MacroMarkersList;
// dist/src/parser/classes/ProductList.js
var ProductList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(ProductList, "ProductList");
ProductList.type = "ProductList";
var ProductList_default = ProductList;
// dist/src/parser/classes/SectionList.js
var SectionList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
if (Reflect.has(data2, "targetId")) {
this.target_id = data2.targetId;
}
if (Reflect.has(data2, "continuations")) {
if (Reflect.has(data2.continuations[0], "nextContinuationData")) {
this.continuation = data2.continuations[0].nextContinuationData.continuation;
} else if (Reflect.has(data2.continuations[0], "reloadContinuationData")) {
this.continuation = data2.continuations[0].reloadContinuationData.continuation;
}
}
if (Reflect.has(data2, "header")) {
this.header = parser_exports.parseItem(data2.header);
}
if (Reflect.has(data2, "subMenu")) {
this.sub_menu = parser_exports.parseItem(data2.subMenu);
}
}
};
__name(SectionList, "SectionList");
SectionList.type = "SectionList";
var SectionList_default = SectionList;
// dist/src/parser/classes/ExpandableVideoDescriptionBody.js
var ExpandableVideoDescriptionBody = class extends YTNode {
constructor(data2) {
var _a3;
super();
this.show_more_text = new Text2(data2.showMoreText);
this.show_less_text = new Text2(data2.showLessText);
if (Reflect.has(data2, "attributedDescriptionBodyText")) {
this.attributed_description_body_text = (_a3 = data2.attributedDescriptionBodyText) === null || _a3 === void 0 ? void 0 : _a3.content;
}
}
};
__name(ExpandableVideoDescriptionBody, "ExpandableVideoDescriptionBody");
ExpandableVideoDescriptionBody.type = "ExpandableVideoDescriptionBody";
var ExpandableVideoDescriptionBody_default = ExpandableVideoDescriptionBody;
// dist/src/parser/classes/SearchRefinementCard.js
var SearchRefinementCard = class extends YTNode {
constructor(data2) {
super();
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.endpoint = new NavigationEndpoint_default(data2.searchEndpoint);
this.query = new Text2(data2.query).toString();
}
};
__name(SearchRefinementCard, "SearchRefinementCard");
SearchRefinementCard.type = "SearchRefinementCard";
var SearchRefinementCard_default = SearchRefinementCard;
// dist/src/parser/classes/GameCard.js
var GameCard = class extends YTNode {
constructor(data2) {
super();
this.game = parser_exports.parseItem(data2.game);
}
};
__name(GameCard, "GameCard");
GameCard.type = "GameCard";
var GameCard_default = GameCard;
// dist/src/parser/classes/HorizontalList.js
var HorizontalList = class extends YTNode {
constructor(data2) {
super();
this.visible_item_count = data2.visibleItemCount;
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(HorizontalList, "HorizontalList");
HorizontalList.type = "HorizontalList";
var HorizontalList_default = HorizontalList;
// dist/src/parser/classes/ExpandableMetadata.js
var ExpandableMetadata = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "header")) {
this.header = {
collapsed_title: new Text2(data2.header.collapsedTitle),
collapsed_thumbnail: Thumbnail.fromResponse(data2.header.collapsedThumbnail),
collapsed_label: new Text2(data2.header.collapsedLabel),
expanded_title: new Text2(data2.header.expandedTitle)
};
}
this.expanded_content = parser_exports.parseItem(data2.expandedContent, [HorizontalCardList_default, HorizontalList_default]);
this.expand_button = parser_exports.parseItem(data2.expandButton, Button_default);
this.collapse_button = parser_exports.parseItem(data2.collapseButton, Button_default);
}
};
__name(ExpandableMetadata, "ExpandableMetadata");
ExpandableMetadata.type = "ExpandableMetadata";
var ExpandableMetadata_default = ExpandableMetadata;
// dist/src/p