Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

youtubei.js

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youtubei.js - npm Package Compare versions

Comparing version 4.2.0 to 4.3.0

dist/src/parser/classes/MusicTastebuilderShelf.d.ts

2

dist/package.json
{
"name": "youtubei.js",
"version": "4.2.0",
"version": "4.3.0",
"description": "A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).",

@@ -5,0 +5,0 @@ "type": "module",

import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
declare class Button extends YTNode {
import type { RawNode } from '../index.js';
export default class Button extends YTNode {
static type: string;

@@ -11,4 +12,3 @@ text?: string;

endpoint: NavigationEndpoint;
constructor(data: any);
constructor(data: RawNode);
}
export default Button;
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
class Button extends YTNode {
export default class Button extends YTNode {
constructor(data) {

@@ -27,3 +27,2 @@ var _a, _b, _c, _d;

Button.type = 'Button';
export default Button;
//# sourceMappingURL=Button.js.map

@@ -8,3 +8,3 @@ import { RawNode } from '../index.js';

import { YTNode } from '../helpers.js';
declare class GridVideo extends YTNode {
export default class GridVideo extends YTNode {
static type: string;

@@ -23,4 +23,8 @@ id: string;

menu: Menu | null;
buttons?: import("../helpers.js").ObservedArray<YTNode> | undefined;
upcoming?: Date;
upcoming_text?: Text;
is_reminder_set?: boolean;
constructor(data: RawNode);
get is_upcoming(): boolean;
}
export default GridVideo;

@@ -8,5 +8,5 @@ import Parser from '../index.js';

import { YTNode } from '../helpers.js';
class GridVideo extends YTNode {
export default class GridVideo extends YTNode {
constructor(data) {
var _a;
var _a, _b;
super();

@@ -26,6 +26,16 @@ const length_alt = (_a = data.thumbnailOverlays.find((overlay) => overlay.hasOwnProperty('thumbnailOverlayTimeStatusRenderer'))) === null || _a === void 0 ? void 0 : _a.thumbnailOverlayTimeStatusRenderer;

this.menu = Parser.parseItem(data.menu, Menu);
if (Reflect.has(data, 'buttons')) {
this.buttons = Parser.parseArray(data.buttons);
}
if (Reflect.has(data, 'upcomingEventData')) {
this.upcoming = new Date(Number(`${data.upcomingEventData.startTime}000`));
this.upcoming_text = new Text(data.upcomingEventData.upcomingEventText);
this.is_reminder_set = !!((_b = data.upcomingEventData) === null || _b === void 0 ? void 0 : _b.isReminderSet);
}
}
get is_upcoming() {
return Boolean(this.upcoming && this.upcoming > new Date());
}
}
GridVideo.type = 'GridVideo';
export default GridVideo;
//# sourceMappingURL=GridVideo.js.map

@@ -0,15 +1,10 @@

import GuideEntry from './GuideEntry.js';
import type { RawNode } from '../index.js';
import { YTNode } from '../helpers.js';
declare class GuideCollapsibleEntry extends YTNode {
export default class GuideCollapsibleEntry extends YTNode {
static type: string;
expander_item: {
title: string;
icon_type: string;
};
collapser_item: {
title: string;
icon_type: string;
};
expander_item: GuideEntry | null;
collapser_item: GuideEntry | null;
expandable_items: import("../helpers.js").ObservedArray<YTNode>;
constructor(data: any);
constructor(data: RawNode);
}
export default GuideCollapsibleEntry;

@@ -1,15 +0,9 @@

import Text from './misc/Text.js';
import Parser from '../parser.js';
import GuideEntry from './GuideEntry.js';
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
class GuideCollapsibleEntry extends YTNode {
export default class GuideCollapsibleEntry extends YTNode {
constructor(data) {
super();
this.expander_item = {
title: new Text(data.expanderItem.guideEntryRenderer.formattedTitle).toString(),
icon_type: data.expanderItem.guideEntryRenderer.icon.iconType
};
this.collapser_item = {
title: new Text(data.collapserItem.guideEntryRenderer.formattedTitle).toString(),
icon_type: data.collapserItem.guideEntryRenderer.icon.iconType
};
this.expander_item = Parser.parseItem(data.expanderItem, GuideEntry);
this.collapser_item = Parser.parseItem(data.collapserItem, GuideEntry);
this.expandable_items = Parser.parseArray(data.expandableItems);

@@ -19,3 +13,2 @@ }

GuideCollapsibleEntry.type = 'GuideCollapsibleEntry';
export default GuideCollapsibleEntry;
//# sourceMappingURL=GuideCollapsibleEntry.js.map

@@ -0,3 +1,4 @@

import type { RawNode } from '../index.js';
import { YTNode } from '../helpers.js';
declare class GuideCollapsibleSectionEntry extends YTNode {
export default class GuideCollapsibleSectionEntry extends YTNode {
static type: string;

@@ -8,4 +9,3 @@ header_entry: YTNode;

section_items: import("../helpers.js").ObservedArray<YTNode>;
constructor(data: any);
constructor(data: RawNode);
}
export default GuideCollapsibleSectionEntry;

@@ -0,4 +1,4 @@

import Parser from '../parser.js';
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
class GuideCollapsibleSectionEntry extends YTNode {
export default class GuideCollapsibleSectionEntry extends YTNode {
constructor(data) {

@@ -13,3 +13,2 @@ super();

GuideCollapsibleSectionEntry.type = 'GuideCollapsibleSectionEntry';
export default GuideCollapsibleSectionEntry;
//# sourceMappingURL=GuideCollapsibleSectionEntry.js.map
import GuideEntry from './GuideEntry.js';
declare class GuideDownloadsEntry extends GuideEntry {
import type { RawNode } from '../index.js';
export default class GuideDownloadsEntry extends GuideEntry {
static type: string;
always_show: boolean;
constructor(data: any);
constructor(data: RawNode);
}
export default GuideDownloadsEntry;
import GuideEntry from './GuideEntry.js';
class GuideDownloadsEntry extends GuideEntry {
export default class GuideDownloadsEntry extends GuideEntry {
constructor(data) {

@@ -9,3 +9,2 @@ super(data.entryRenderer.guideEntryRenderer);

GuideDownloadsEntry.type = 'GuideDownloadsEntry';
export default GuideDownloadsEntry;
//# sourceMappingURL=GuideDownloadsEntry.js.map

@@ -0,6 +1,7 @@

import NavigationEndpoint from './NavigationEndpoint.js';
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import Thumbnail from './misc/Thumbnail.js';
import { YTNode } from '../helpers.js';
import Thumbnail from './misc/Thumbnail.js';
declare class GuideEntry extends YTNode {
import type { RawNode } from '../index.js';
export default class GuideEntry extends YTNode {
static type: string;

@@ -13,4 +14,3 @@ title: Text;

is_primary: boolean;
constructor(data: any);
constructor(data: RawNode);
}
export default GuideEntry;

@@ -0,18 +1,18 @@

import NavigationEndpoint from './NavigationEndpoint.js';
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import Thumbnail from './misc/Thumbnail.js';
import { YTNode } from '../helpers.js';
import Thumbnail from './misc/Thumbnail.js';
class GuideEntry extends YTNode {
export default class GuideEntry extends YTNode {
constructor(data) {
var _a;
super();
this.title = new Text(data.formattedTitle);
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);
if ((_a = data.icon) === null || _a === void 0 ? void 0 : _a.iconType) {
if (Reflect.has(data, 'icon') && Reflect.has(data.icon, 'iconType')) {
this.icon_type = data.icon.iconType;
}
if (data.thumbnail) {
if (Reflect.has(data, 'thumbnail')) {
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
}
if (data.badges) {
// (LuanRT) XXX: Check this property's data and parse it.
if (Reflect.has(data, 'badges')) {
this.badges = data.badges;

@@ -24,3 +24,2 @@ }

GuideEntry.type = 'GuideEntry';
export default GuideEntry;
//# sourceMappingURL=GuideEntry.js.map
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
declare class GuideSection extends YTNode {
import type { RawNode } from '../index.js';
export default class GuideSection extends YTNode {
static type: string;
title?: Text;
items: import("../helpers.js").ObservedArray<YTNode>;
constructor(data: any);
constructor(data: RawNode);
}
export default GuideSection;
import Text from './misc/Text.js';
import Parser from '../parser.js';
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
class GuideSection extends YTNode {
export default class GuideSection extends YTNode {
constructor(data) {
super();
if (data.formattedTitle) {
if (Reflect.has(data, 'formattedTitle')) {
this.title = new Text(data.formattedTitle);

@@ -14,3 +14,2 @@ }

GuideSection.type = 'GuideSection';
export default GuideSection;
//# sourceMappingURL=GuideSection.js.map
import GuideSection from './GuideSection.js';
declare class GuideSubscriptionsSection extends GuideSection {
export default class GuideSubscriptionsSection extends GuideSection {
static type: string;
}
export default GuideSubscriptionsSection;
import GuideSection from './GuideSection.js';
class GuideSubscriptionsSection extends GuideSection {
export default class GuideSubscriptionsSection extends GuideSection {
}
GuideSubscriptionsSection.type = 'GuideSubscriptionsSection';
export default GuideSubscriptionsSection;
//# sourceMappingURL=GuideSubscriptionsSection.js.map

@@ -1,17 +0,23 @@

import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';
import MusicItemThumbnailOverlay from './MusicItemThumbnailOverlay.js';
import MusicResponsiveListItemFixedColumn from './MusicResponsiveListItemFixedColumn.js';
import MusicResponsiveListItemFlexColumn from './MusicResponsiveListItemFlexColumn.js';
import MusicThumbnail from './MusicThumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import MusicItemThumbnailOverlay from './MusicItemThumbnailOverlay.js';
import Menu from './menus/Menu.js';
import Text from './misc/Text.js';
import type { ObservedArray } from '../helpers.js';
import { YTNode } from '../helpers.js';
declare class MusicResponsiveListItem extends YTNode {
import type { RawNode } from '../index.js';
export default class MusicResponsiveListItem extends YTNode {
#private;
static type: string;
flex_columns: ObservedArray<MusicResponsiveListItemFlexColumn>;
fixed_columns: ObservedArray<MusicResponsiveListItemFixedColumn>;
endpoint: NavigationEndpoint | null;
item_type: string | undefined;
index: Text | undefined;
thumbnails: Thumbnail[];
badges: import("../helpers.js").ObservedArray<YTNode>;
menu: Menu | null;
overlay: MusicItemThumbnailOverlay | null;
item_type: 'album' | 'playlist' | 'artist' | 'library_artist' | 'video' | 'song' | 'endpoint' | 'unknown' | undefined;
index?: Text;
thumbnail?: MusicThumbnail | null;
badges: ObservedArray<YTNode>;
menu?: Menu | null;
overlay?: MusicItemThumbnailOverlay | null;
id?: string;

@@ -48,6 +54,6 @@ title?: string;

};
item_count?: string | undefined;
item_count?: string;
year?: string;
constructor(data: any);
constructor(data: RawNode);
get thumbnails(): import("./misc/Thumbnail.js").default[];
}
export default MusicResponsiveListItem;

@@ -1,25 +0,22 @@

// TODO: this needs a refactor
// Seems like a mess to use
var _MusicResponsiveListItem_instances, _MusicResponsiveListItem_flex_columns, _MusicResponsiveListItem_fixed_columns, _MusicResponsiveListItem_playlist_item_data, _MusicResponsiveListItem_parseOther, _MusicResponsiveListItem_parseVideoOrSong, _MusicResponsiveListItem_parseSong, _MusicResponsiveListItem_parseVideo, _MusicResponsiveListItem_parseArtist, _MusicResponsiveListItem_parseLibraryArtist, _MusicResponsiveListItem_parseAlbum, _MusicResponsiveListItem_parsePlaylist;
// TODO: Clean up and refactor this.
var _MusicResponsiveListItem_instances, _MusicResponsiveListItem_playlist_item_data, _MusicResponsiveListItem_parseOther, _MusicResponsiveListItem_parseVideoOrSong, _MusicResponsiveListItem_parseSong, _MusicResponsiveListItem_parseVideo, _MusicResponsiveListItem_parseArtist, _MusicResponsiveListItem_parseLibraryArtist, _MusicResponsiveListItem_parseAlbum, _MusicResponsiveListItem_parsePlaylist;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import Parser from '../index.js';
import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import MusicItemThumbnailOverlay from './MusicItemThumbnailOverlay.js';
import MusicResponsiveListItemFixedColumn from './MusicResponsiveListItemFixedColumn.js';
import MusicResponsiveListItemFlexColumn from './MusicResponsiveListItemFlexColumn.js';
import MusicResponsiveListItemFixedColumn from './MusicResponsiveListItemFixedColumn.js';
import MusicThumbnail from './MusicThumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import Menu from './menus/Menu.js';
import { timeToSeconds } from '../../utils/Utils.js';
import Text from './misc/Text.js';
import { isTextRun, timeToSeconds } from '../../utils/Utils.js';
import { YTNode } from '../helpers.js';
class MusicResponsiveListItem extends YTNode {
export default class MusicResponsiveListItem extends YTNode {
constructor(data) {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e, _f;
super();
_MusicResponsiveListItem_instances.add(this);
_MusicResponsiveListItem_flex_columns.set(this, void 0);
_MusicResponsiveListItem_fixed_columns.set(this, void 0);
_MusicResponsiveListItem_playlist_item_data.set(this, void 0);
__classPrivateFieldSet(this, _MusicResponsiveListItem_flex_columns, Parser.parseArray(data.flexColumns, MusicResponsiveListItemFlexColumn), "f");
__classPrivateFieldSet(this, _MusicResponsiveListItem_fixed_columns, Parser.parseArray(data.fixedColumns, MusicResponsiveListItemFixedColumn), "f");
this.flex_columns = Parser.parseArray(data.flexColumns, MusicResponsiveListItemFlexColumn);
this.fixed_columns = Parser.parseArray(data.fixedColumns, MusicResponsiveListItemFixedColumn);
__classPrivateFieldSet(this, _MusicResponsiveListItem_playlist_item_data, {

@@ -50,3 +47,3 @@ video_id: ((_a = data === null || data === void 0 ? void 0 : data.playlistItemData) === null || _a === void 0 ? void 0 : _a.videoId) || null,

default:
if (__classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1]) {
if (this.flex_columns[1]) {
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseVideoOrSong).call(this);

@@ -62,3 +59,3 @@ }

}
this.thumbnails = data.thumbnail ? Thumbnail.fromResponse((_g = data.thumbnail.musicThumbnailRenderer) === null || _g === void 0 ? void 0 : _g.thumbnail) : [];
this.thumbnail = Parser.parseItem(data.thumbnail, MusicThumbnail);
this.badges = Parser.parseArray(data.badges);

@@ -68,5 +65,9 @@ this.menu = Parser.parseItem(data.menu, Menu);

}
get thumbnails() {
var _a;
return ((_a = this.thumbnail) === null || _a === void 0 ? void 0 : _a.contents) || [];
}
}
_MusicResponsiveListItem_flex_columns = new WeakMap(), _MusicResponsiveListItem_fixed_columns = new WeakMap(), _MusicResponsiveListItem_playlist_item_data = new WeakMap(), _MusicResponsiveListItem_instances = new WeakSet(), _MusicResponsiveListItem_parseOther = function _MusicResponsiveListItem_parseOther() {
this.title = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
_MusicResponsiveListItem_playlist_item_data = new WeakMap(), _MusicResponsiveListItem_instances = new WeakSet(), _MusicResponsiveListItem_parseOther = function _MusicResponsiveListItem_parseOther() {
this.title = this.flex_columns.first().key('title').instanceof(Text).toString();
if (this.endpoint) {

@@ -79,4 +80,4 @@ this.item_type = 'endpoint';

}, _MusicResponsiveListItem_parseVideoOrSong = function _MusicResponsiveListItem_parseVideoOrSong() {
var _a;
const is_video = (_a = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _a === void 0 ? void 0 : _a.some((run) => run.text.match(/(.*?) views/));
var _a, _b;
const is_video = (_b = (_a = this.flex_columns.at(1)) === null || _a === void 0 ? void 0 : _a.key('title').instanceof(Text).runs) === null || _b === void 0 ? void 0 : _b.some((run) => run.text.match(/(.*?) views/));
if (is_video) {

@@ -91,28 +92,31 @@ this.item_type = 'video';

}, _MusicResponsiveListItem_parseSong = function _MusicResponsiveListItem_parseSong() {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
this.id = __classPrivateFieldGet(this, _MusicResponsiveListItem_playlist_item_data, "f").video_id || ((_b = (_a = this.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.videoId);
this.title = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
const duration_text = ((_d = (_c = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _c === void 0 ? void 0 : _c.find((run) => (/^\d+$/).test(run.text.replace(/:/g, '')))) === null || _d === void 0 ? void 0 : _d.text) ||
((_g = (_f = (_e = __classPrivateFieldGet(this, _MusicResponsiveListItem_fixed_columns, "f")) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.key('title').instanceof(Text)) === null || _g === void 0 ? void 0 : _g.toString());
duration_text && (this.duration = {
text: duration_text,
seconds: timeToSeconds(duration_text)
});
const album = ((_h = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _h === void 0 ? void 0 : _h.find((run) => { var _a, _b; return (_b = (_a = Reflect.get(run, 'endpoint')) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId.startsWith('MPR'); })) ||
((_k = (_j = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[2]) === null || _j === void 0 ? void 0 : _j.key('title').instanceof(Text).runs) === null || _k === void 0 ? void 0 : _k.find((run) => { var _a, _b; return (_b = (_a = Reflect.get(run, 'endpoint')) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId.startsWith('MPR'); }));
if (album) {
this.title = this.flex_columns.first().key('title').instanceof(Text).toString();
const duration_text = ((_e = (_d = (_c = this.flex_columns.at(1)) === null || _c === void 0 ? void 0 : _c.key('title').instanceof(Text).runs) === null || _d === void 0 ? void 0 : _d.find((run) => (/^\d+$/).test(run.text.replace(/:/g, '')))) === null || _e === void 0 ? void 0 : _e.text) || ((_g = (_f = this.fixed_columns.first()) === null || _f === void 0 ? void 0 : _f.key('title').instanceof(Text)) === null || _g === void 0 ? void 0 : _g.toString());
if (duration_text) {
this.duration = {
text: duration_text,
seconds: timeToSeconds(duration_text)
};
}
const album_run = ((_j = (_h = this.flex_columns.at(1)) === null || _h === void 0 ? void 0 : _h.key('title').instanceof(Text).runs) === null || _j === void 0 ? void 0 : _j.find((run) => (isTextRun(run) && run.endpoint) &&
run.endpoint.payload.browseId.startsWith('MPR'))) ||
((_l = (_k = this.flex_columns.at(2)) === null || _k === void 0 ? void 0 : _k.key('title').instanceof(Text).runs) === null || _l === void 0 ? void 0 : _l.find((run) => (isTextRun(run) && run.endpoint) &&
run.endpoint.payload.browseId.startsWith('MPR')));
if (album_run && isTextRun(album_run)) {
this.album = {
id: (_m = (_l = album.endpoint) === null || _l === void 0 ? void 0 : _l.payload) === null || _m === void 0 ? void 0 : _m.browseId,
name: album.text,
endpoint: album.endpoint
id: (_o = (_m = album_run.endpoint) === null || _m === void 0 ? void 0 : _m.payload) === null || _o === void 0 ? void 0 : _o.browseId,
name: album_run.text,
endpoint: album_run.endpoint
};
}
const artists = (_o = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _o === void 0 ? void 0 : _o.filter((run) => { var _a, _b; return (_b = (_a = Reflect.get(run, 'endpoint')) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId.startsWith('UC'); });
if (artists) {
this.artists = artists.map((artist) => {
const artist_runs = (_q = (_p = this.flex_columns.at(1)) === null || _p === void 0 ? void 0 : _p.key('title').instanceof(Text).runs) === null || _q === void 0 ? void 0 : _q.filter((run) => (isTextRun(run) && run.endpoint) && run.endpoint.payload.browseId.startsWith('UC'));
if (artist_runs) {
this.artists = artist_runs.map((run) => {
var _a, _b;
return ({
name: artist.text,
channel_id: (_b = (_a = artist.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId,
endpoint: artist.endpoint
name: run.text,
channel_id: isTextRun(run) ? (_b = (_a = run.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId : undefined,
endpoint: isTextRun(run) ? run.endpoint : undefined
});

@@ -122,58 +126,63 @@ });

}, _MusicResponsiveListItem_parseVideo = function _MusicResponsiveListItem_parseVideo() {
var _a, _b, _c, _d, _e, _f, _g, _h;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
this.id = __classPrivateFieldGet(this, _MusicResponsiveListItem_playlist_item_data, "f").video_id;
this.title = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
this.views = (_b = (_a = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _a === void 0 ? void 0 : _a.find((run) => run.text.match(/(.*?) views/))) === null || _b === void 0 ? void 0 : _b.text;
const authors = (_c = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _c === void 0 ? void 0 : _c.filter((run) => { var _a, _b; return (_b = (_a = Reflect.get(run, 'endpoint')) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId.startsWith('UC'); });
if (authors) {
this.authors = authors.map((author) => {
this.title = this.flex_columns.first().key('title').instanceof(Text).toString();
this.views = (_c = (_b = (_a = this.flex_columns.at(1)) === null || _a === void 0 ? void 0 : _a.key('title').instanceof(Text).runs) === null || _b === void 0 ? void 0 : _b.find((run) => run.text.match(/(.*?) views/))) === null || _c === void 0 ? void 0 : _c.toString();
const author_runs = (_e = (_d = this.flex_columns.at(1)) === null || _d === void 0 ? void 0 : _d.key('title').instanceof(Text).runs) === null || _e === void 0 ? void 0 : _e.filter((run) => (isTextRun(run) && run.endpoint) &&
run.endpoint.payload.browseId.startsWith('UC'));
if (author_runs) {
this.authors = author_runs.map((run) => {
var _a, _b;
return ({
name: author.text,
channel_id: (_b = (_a = author.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId,
endpoint: author.endpoint
});
return {
name: run.text,
channel_id: isTextRun(run) ? (_b = (_a = run.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId : undefined,
endpoint: isTextRun(run) ? run.endpoint : undefined
};
});
}
const duration_text = ((_e = (_d = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _d === void 0 ? void 0 : _d.find((run) => (/^\d+$/).test(run.text.replace(/:/g, '')))) === null || _e === void 0 ? void 0 : _e.text) ||
((_h = (_g = (_f = __classPrivateFieldGet(this, _MusicResponsiveListItem_fixed_columns, "f")[0]) === null || _f === void 0 ? void 0 : _f.key('title').instanceof(Text).runs) === null || _g === void 0 ? void 0 : _g.find((run) => (/^\d+$/).test(run.text.replace(/:/g, '')))) === null || _h === void 0 ? void 0 : _h.text);
duration_text && (this.duration = {
text: duration_text,
seconds: timeToSeconds(duration_text)
});
const duration_text = ((_g = (_f = this.flex_columns[1].key('title').instanceof(Text).runs) === null || _f === void 0 ? void 0 : _f.find((run) => (/^\d+$/).test(run.text.replace(/:/g, '')))) === null || _g === void 0 ? void 0 : _g.text) || ((_k = (_j = (_h = this.fixed_columns.first()) === null || _h === void 0 ? void 0 : _h.key('title').instanceof(Text).runs) === null || _j === void 0 ? void 0 : _j.find((run) => (/^\d+$/).test(run.text.replace(/:/g, '')))) === null || _k === void 0 ? void 0 : _k.text);
if (duration_text) {
this.duration = {
text: duration_text,
seconds: timeToSeconds(duration_text)
};
}
}, _MusicResponsiveListItem_parseArtist = function _MusicResponsiveListItem_parseArtist() {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
this.id = (_b = (_a = this.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId;
this.name = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
this.subtitle = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text);
this.subscribers = ((_d = (_c = this.subtitle.runs) === null || _c === void 0 ? void 0 : _c.find((run) => (/^(\d*\.)?\d+[M|K]? subscribers?$/i).test(run.text))) === null || _d === void 0 ? void 0 : _d.text) || '';
this.name = this.flex_columns.first().key('title').instanceof(Text).toString();
this.subtitle = (_c = this.flex_columns.at(1)) === null || _c === void 0 ? void 0 : _c.key('title').instanceof(Text);
this.subscribers = ((_f = (_e = (_d = this.subtitle) === null || _d === void 0 ? void 0 : _d.runs) === null || _e === void 0 ? void 0 : _e.find((run) => (/^(\d*\.)?\d+[M|K]? subscribers?$/i).test(run.text))) === null || _f === void 0 ? void 0 : _f.text) || '';
}, _MusicResponsiveListItem_parseLibraryArtist = function _MusicResponsiveListItem_parseLibraryArtist() {
var _a, _b, _c;
this.name = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
this.subtitle = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text);
this.song_count = ((_c = (_b = (_a = this.subtitle) === null || _a === void 0 ? void 0 : _a.runs) === null || _b === void 0 ? void 0 : _b.find((run) => (/^\d+(,\d+)? songs?$/i).test(run.text))) === null || _c === void 0 ? void 0 : _c.text) || '';
var _a, _b, _c, _d;
this.name = this.flex_columns.first().key('title').instanceof(Text).toString();
this.subtitle = (_a = this.flex_columns.at(1)) === null || _a === void 0 ? void 0 : _a.key('title').instanceof(Text);
this.song_count = ((_d = (_c = (_b = this.subtitle) === null || _b === void 0 ? void 0 : _b.runs) === null || _c === void 0 ? void 0 : _c.find((run) => (/^\d+(,\d+)? songs?$/i).test(run.text))) === null || _d === void 0 ? void 0 : _d.text) || '';
}, _MusicResponsiveListItem_parseAlbum = function _MusicResponsiveListItem_parseAlbum() {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
this.id = (_b = (_a = this.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId;
this.title = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
const author = (_c = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _c === void 0 ? void 0 : _c.find((run) => { var _a, _b; return (_b = (_a = Reflect.get(run, 'endpoint')) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId.startsWith('UC'); });
author && (this.author = {
name: author.text,
channel_id: (_e = (_d = author.endpoint) === null || _d === void 0 ? void 0 : _d.payload) === null || _e === void 0 ? void 0 : _e.browseId,
endpoint: author.endpoint
});
this.year = (_g = (_f = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _f === void 0 ? void 0 : _f.find((run) => (/^[12][0-9]{3}$/).test(run.text))) === null || _g === void 0 ? void 0 : _g.text;
this.title = this.flex_columns.first().title.toString();
const author_run = (_d = (_c = this.flex_columns.at(1)) === null || _c === void 0 ? void 0 : _c.key('title').instanceof(Text).runs) === null || _d === void 0 ? void 0 : _d.find((run) => (isTextRun(run) && run.endpoint) &&
run.endpoint.payload.browseId.startsWith('UC'));
if (author_run && isTextRun(author_run)) {
this.author = {
name: author_run.text,
channel_id: (_f = (_e = author_run.endpoint) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.browseId,
endpoint: author_run.endpoint
};
}
this.year = (_j = (_h = (_g = this.flex_columns.at(1)) === null || _g === void 0 ? void 0 : _g.key('title').instanceof(Text).runs) === null || _h === void 0 ? void 0 : _h.find((run) => (/^[12][0-9]{3}$/).test(run.text))) === null || _j === void 0 ? void 0 : _j.text;
}, _MusicResponsiveListItem_parsePlaylist = function _MusicResponsiveListItem_parsePlaylist() {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h;
this.id = (_b = (_a = this.endpoint) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId;
this.title = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[0].key('title').instanceof(Text).toString();
const item_count_run = (_c = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title')
.instanceof(Text).runs) === null || _c === void 0 ? void 0 : _c.find((run) => run.text.match(/\d+ (song|songs)/));
this.title = this.flex_columns.first().title.toString();
const item_count_run = (_d = (_c = this.flex_columns.at(1)) === null || _c === void 0 ? void 0 : _c.key('title').instanceof(Text).runs) === null || _d === void 0 ? void 0 : _d.find((run) => run.text.match(/\d+ (song|songs)/));
this.item_count = item_count_run ? item_count_run.text : undefined;
const author = (_d = __classPrivateFieldGet(this, _MusicResponsiveListItem_flex_columns, "f")[1].key('title').instanceof(Text).runs) === null || _d === void 0 ? void 0 : _d.find((run) => { var _a, _b; return (_b = (_a = Reflect.get(run, 'endpoint')) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.browseId.startsWith('UC'); });
if (author) {
const author_run = (_f = (_e = this.flex_columns.at(1)) === null || _e === void 0 ? void 0 : _e.key('title').instanceof(Text).runs) === null || _f === void 0 ? void 0 : _f.find((run) => (isTextRun(run) && run.endpoint) &&
run.endpoint.payload.browseId.startsWith('UC'));
if (author_run && isTextRun(author_run)) {
this.author = {
name: author.text,
channel_id: (_f = (_e = author.endpoint) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.browseId,
endpoint: author.endpoint
name: author_run.text,
channel_id: (_h = (_g = author_run.endpoint) === null || _g === void 0 ? void 0 : _g.payload) === null || _h === void 0 ? void 0 : _h.browseId,
endpoint: author_run.endpoint
};

@@ -183,3 +192,2 @@ }

MusicResponsiveListItem.type = 'MusicResponsiveListItem';
export default MusicResponsiveListItem;
//# sourceMappingURL=MusicResponsiveListItem.js.map

@@ -20,3 +20,3 @@ import type Actions from '../../core/Actions.js';

*/
getEndpoint(name: string): "/browse" | "/player" | "/search" | "/next" | "live_chat/get_item_context_menu" | undefined;
getEndpoint(name: string): "/player" | "/search" | "/browse" | "/next" | "live_chat/get_item_context_menu" | undefined;
call<T extends IParsedResponse>(actions: Actions, args: {

@@ -23,0 +23,0 @@ [key: string]: any;

import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
declare class ToggleMenuServiceItem extends YTNode {
import type { RawNode } from '../index.js';
export default class ToggleMenuServiceItem extends YTNode {
static type: string;

@@ -10,5 +11,5 @@ text: Text;

toggled_icon_type: string;
endpoint: NavigationEndpoint;
constructor(data: any);
default_endpoint: NavigationEndpoint;
toggled_endpoint: NavigationEndpoint;
constructor(data: RawNode);
}
export default ToggleMenuServiceItem;
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
class ToggleMenuServiceItem extends YTNode {
export default class ToggleMenuServiceItem extends YTNode {
constructor(data) {

@@ -11,7 +11,7 @@ super();

this.toggled_icon_type = data.toggledIcon.iconType;
this.endpoint = new NavigationEndpoint(data.toggledServiceEndpoint);
this.default_endpoint = new NavigationEndpoint(data.defaultServiceEndpoint);
this.toggled_endpoint = new NavigationEndpoint(data.toggledServiceEndpoint);
}
}
ToggleMenuServiceItem.type = 'ToggleMenuServiceItem';
export default ToggleMenuServiceItem;
//# sourceMappingURL=ToggleMenuServiceItem.js.map

@@ -219,2 +219,4 @@ export { default as AccountChannel } from './classes/AccountChannel.js';

export { default as MusicSortFilterButton } from './classes/MusicSortFilterButton.js';
export { default as MusicTastebuilderShelf } from './classes/MusicTastebuilderShelf.js';
export { default as MusicTastebuilderShelfThumbnail } from './classes/MusicTastebuilderShelfThumbnail.js';
export { default as MusicThumbnail } from './classes/MusicThumbnail.js';

@@ -221,0 +223,0 @@ export { default as MusicTwoRowItem } from './classes/MusicTwoRowItem.js';

@@ -221,2 +221,4 @@ // This file was auto generated, do not edit.

export { default as MusicSortFilterButton } from './classes/MusicSortFilterButton.js';
export { default as MusicTastebuilderShelf } from './classes/MusicTastebuilderShelf.js';
export { default as MusicTastebuilderShelfThumbnail } from './classes/MusicTastebuilderShelfThumbnail.js';
export { default as MusicThumbnail } from './classes/MusicThumbnail.js';

@@ -223,0 +225,0 @@ export { default as MusicTwoRowItem } from './classes/MusicTwoRowItem.js';

@@ -29,5 +29,5 @@ import Feed from '../../core/Feed.js';

constructor(actions: Actions, data: ApiResponse | IBrowseResponse, already_parsed?: boolean);
get items(): ObservedArray<import("../classes/CompactVideo.js").default | import("../classes/Video.js").default | import("../classes/GridVideo.js").default | import("../classes/PlaylistPanelVideo.js").default | import("../classes/PlaylistVideo.js").default | import("../classes/ReelItem.js").default | import("../classes/WatchCardCompactVideo.js").default>;
get items(): ObservedArray<import("../classes/CompactVideo.js").default | import("../classes/Video.js").default | import("../nodes.js").GridVideo | import("../classes/PlaylistPanelVideo.js").default | import("../classes/PlaylistVideo.js").default | import("../classes/ReelItem.js").default | import("../classes/WatchCardCompactVideo.js").default>;
getContinuation(): Promise<Playlist>;
}
export default Playlist;
import MusicCarouselShelf from '../classes/MusicCarouselShelf.js';
import MusicTastebuilderShelf from '../classes/MusicTastebuilderShelf.js';
import type Actions from '../../core/Actions.js';

@@ -8,3 +9,3 @@ import type { ApiResponse } from '../../core/Actions.js';

#private;
sections?: ObservedArray<MusicCarouselShelf>;
sections?: ObservedArray<MusicCarouselShelf | MusicTastebuilderShelf>;
constructor(response: ApiResponse, actions: Actions);

@@ -11,0 +12,0 @@ /**

var _HomeFeed_page, _HomeFeed_actions, _HomeFeed_continuation;
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { InnertubeError } from '../../utils/Utils.js';
import Parser, { SectionListContinuation } from '../index.js';
import MusicCarouselShelf from '../classes/MusicCarouselShelf.js';
import SectionList from '../classes/SectionList.js';
import SingleColumnBrowseResults from '../classes/SingleColumnBrowseResults.js';
import Parser, { SectionListContinuation } from '../index.js';
import MusicTastebuilderShelf from '../classes/MusicTastebuilderShelf.js';
import { InnertubeError } from '../../utils/Utils.js';
class HomeFeed {

@@ -27,3 +28,3 @@ constructor(response, actions) {

__classPrivateFieldSet(this, _HomeFeed_continuation, (_c = tab.content) === null || _c === void 0 ? void 0 : _c.as(SectionList).continuation, "f");
this.sections = (_d = tab.content) === null || _d === void 0 ? void 0 : _d.as(SectionList).contents.as(MusicCarouselShelf);
this.sections = (_d = tab.content) === null || _d === void 0 ? void 0 : _d.as(SectionList).contents.as(MusicCarouselShelf, MusicTastebuilderShelf);
}

@@ -30,0 +31,0 @@ /**

import { Memo } from '../parser/helpers.js';
import { EmojiRun, TextRun } from '../parser/misc.js';
import PlatformShim, { FetchFunction } from '../types/PlatformShim.js';

@@ -67,1 +68,2 @@ export declare class Platform {

export declare function base64ToU8(base64: string): Uint8Array;
export declare function isTextRun(run: TextRun | EmojiRun): run is TextRun;

@@ -195,2 +195,5 @@ var _a, _Platform_shim;

}
export function isTextRun(run) {
return !('emoji' in run);
}
//# sourceMappingURL=Utils.js.map
{
"name": "youtubei.js",
"version": "4.2.0",
"version": "4.3.0",
"description": "A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).",

@@ -5,0 +5,0 @@ "type": "module",

@@ -34,3 +34,3 @@ <!-- BADGE LINKS -->

<br>
<a href="https://serpapi.com#gh-light-mode-only" target="_blank">
<a href="https://serpapi.com" target="_blank">
<img width="80" alt="SerpApi" src="https://luanrt.is-a.dev/assets/img/serpapi.svg" />

@@ -37,0 +37,0 @@ <br>

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc