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

libmuse

Package Overview
Dependencies
Maintainers
0
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libmuse - npm Package Compare versions

Comparing version 0.0.99 to 0.0.100

16

esm/mixins/browsing.js
import CONSTANTS2 from "../constants-ng.js";
import { get_continuations, get_sort_continuations } from "../continuations.js";
import { CAROUSEL, CONTENT, DESCRIPTION, DESCRIPTION_SHELF, find_object_by_key, GRID, GRID_ITEMS, MRLIR, MRLITFC, MUSIC_SHELF, NAVIGATION_BROWSE_ID, NAVIGATION_PLAYLIST_ID, RUN_TEXT, SECTION_LIST, SECTION_LIST_ITEM, SINGLE_COLUMN_TAB, TEXT_RUN_TEXT, THUMBNAIL, THUMBNAILS, TITLE, TITLE_TEXT, } from "../nav.js";
import { CAROUSEL, CONTENT, DESCRIPTION, DESCRIPTION_SHELF, find_object_by_key, GRID, GRID_ITEMS, MRLIR, MRLITFC, MUSIC_SHELF, NAVIGATION_BROWSE_ID, NAVIGATION_PLAYLIST_ID, RESPONSIVE_HEADER, RUN_TEXT, SECTION_LIST, SECTION_LIST_ITEM, SINGLE_COLUMN_TAB, TEXT_RUN_TEXT, THUMBNAIL, THUMBNAILS, TITLE, TITLE_TEXT, } from "../nav.js";
import { parse_album_header } from "../parsers/albums.js";
import { find_context_param, parse_album, parse_artist_contents, parse_channel_contents, parse_content_list, parse_mixed_content, parse_moods, parse_playlist, } from "../parsers/browsing.js";
import { find_context_param, parse_album, parse_artist_contents, parse_channel_contents, parse_content_list, parse_mixed_content, parse_moods, parse_playlist, parse_two_columns, } from "../parsers/browsing.js";
import { parse_playlist_items, } from "../parsers/playlists.js";

@@ -98,3 +98,3 @@ import { parse_format } from "../parsers/songs.js";

export async function get_album(browseId, options = {}) {
const response = await request_json("browse", {
const json = await request_json("browse", {
data: {

@@ -105,10 +105,12 @@ browseId,

});
const results = j(response, SINGLE_COLUMN_TAB, SECTION_LIST_ITEM, MUSIC_SHELF);
const carousel = jo(response, SINGLE_COLUMN_TAB, SECTION_LIST, "1", CAROUSEL);
const header = parse_album_header(response);
const { tab, secondary } = parse_two_columns(json);
const header = parse_album_header(j(tab, SECTION_LIST_ITEM, RESPONSIVE_HEADER));
const results = j(secondary, SECTION_LIST_ITEM, MUSIC_SHELF);
const carousel = jo(secondary, SECTION_LIST, "1", CAROUSEL);
const album = {
id: find_context_param(response, "browse_id"),
id: find_context_param(json, "browse_id"),
...header,
tracks: parse_playlist_items(results.contents),
other_versions: null,
duration_seconds: 0,
};

@@ -115,0 +117,0 @@ if (carousel != null) {

import { get_continuation_contents, get_continuation_params, get_continuations, } from "../continuations.js";
import { CAROUSEL, CONTENT, DESCRIPTION, MUSIC_SHELF, SECTION_LIST_CONTINUATION, SECTION_LIST_ITEM, SINGLE_COLUMN_TAB, SUBTITLE, SUBTITLE3, THUMBNAIL_CROPPED, THUMBNAIL_RENDERER, TITLE_TEXT, } from "../nav.js";
import { CAROUSEL, CONTENT, DESCRIPTION, DESCRIPTION_SHELF, MUSIC_SHELF, SECTION_LIST_CONTINUATION, SECTION_LIST_ITEM, SUBTITLE, THUMBNAIL_RENDERER, THUMBNAILS, TITLE_TEXT, } from "../nav.js";
import { parse_content_list, parse_playlist, } from "../parsers/browsing.js";

@@ -10,2 +10,3 @@ import { parse_playlist_items, validate_playlist_id, } from "../parsers/playlists.js";

import { ERROR_CODE, MuseError } from "../errors.js";
import { parse_two_columns } from "../parsers/browsing.js";
export async function get_playlist_suggestions(playlistId, continuation, options = {}) {

@@ -16,3 +17,3 @@ const { signal, limit = 6 } = options;

const endpoint = "browse";
const continued_suggestions = await get_continuations(continuation, "musicShelfContinuation", limit, (params) => request_json(endpoint, { data, params, signal }), data => parse_playlist_items(data), undefined, true);
const continued_suggestions = await get_continuations(continuation, "musicShelfContinuation", limit, (params) => request_json(endpoint, { data, params, signal }), (data) => parse_playlist_items(data), undefined, true);
const suggestions = {

@@ -42,33 +43,22 @@ suggestions: continued_suggestions.items,

const json = await request_json(endpoint, { data, signal });
const results = j(json, SINGLE_COLUMN_TAB, SECTION_LIST_ITEM, "musicPlaylistShelfRenderer");
const own_playlist = "musicEditablePlaylistDetailHeaderRenderer" in
json.header;
const header = own_playlist
? json.header.musicEditablePlaylistDetailHeaderRenderer.header
.musicDetailHeaderRenderer
: json.header.musicDetailHeaderRenderer;
const { tab, secondary } = parse_two_columns(json);
const results = j(secondary, SECTION_LIST_ITEM, "musicPlaylistShelfRenderer");
const json_header = j(tab, SECTION_LIST_ITEM);
const header = jo(json_header, "musicEditablePlaylistDetailHeaderRenderer.header.musicResponsiveHeaderRenderer") ?? j(json_header, "musicResponsiveHeaderRenderer");
const editHeader = jo(json_header, "musicEditablePlaylistDetailHeaderRenderer.editHeader.musicPlaylistEditHeaderRenderer");
const own_playlist = !!editHeader;
const run_count = header.subtitle.runs.length;
const trackCount = header.secondSubtitle.runs
? header.secondSubtitle.runs[0].text
: null;
const duration = header.secondSubtitle.runs && header.secondSubtitle.runs.length > 2
? header.secondSubtitle.runs[2].text
: null;
const secondRuns = header.secondSubtitle.runs;
const playlist = {
id: results.playlistId,
privacy: own_playlist
? json.header.musicEditablePlaylistDetailHeaderRenderer.editHeader
.musicPlaylistEditHeaderRenderer.privacy
: "PUBLIC",
privacy: own_playlist ? editHeader.privacy : "PUBLIC",
editable: own_playlist,
title: j(header, TITLE_TEXT),
thumbnails: j(header, THUMBNAIL_CROPPED),
description: jo(header, DESCRIPTION),
thumbnails: j(header, THUMBNAILS),
description: jo(header, "description", DESCRIPTION_SHELF, DESCRIPTION),
type: run_count > 0 ? j(header, SUBTITLE) : null,
authors: run_count > 1
? parse_song_artists_runs(header.subtitle.runs.slice(2, run_count >= 5 ? -2 : undefined))
: [],
year: run_count === 5 ? j(header, SUBTITLE3) : null,
trackCount: trackCount,
duration,
authors: parse_song_artists_runs(header.straplineTextOne.runs),
year: j(header, "subtitle.runs", (run_count - 1).toString(), "text"),
trackCount: secondRuns ? secondRuns[0].text : null,
duration: secondRuns && secondRuns.length > 2 ? secondRuns[2].text : null,
duration_seconds: 0,

@@ -83,3 +73,3 @@ tracks: parse_playlist_items(results.contents ?? []),

// suggestions and related are missing e.g. on liked songs
const section_list = j(json, SINGLE_COLUMN_TAB, "sectionListRenderer");
const section_list = j(secondary, "sectionListRenderer");
if ("continuations" in section_list) {

@@ -86,0 +76,0 @@ let params = get_continuation_params(section_list);

@@ -33,2 +33,5 @@ // commonly used navigation paths

export const NAVIGATION_VIDEO_TYPE = "watchEndpoint.watchEndpointMusicSupportedConfigs.watchEndpointMusicConfig.musicVideoType";
export const PLAY_WATCH = "playNavigationEndpoint.watchEndpoint";
export const PLAY_VIDEO_ID = `${PLAY_WATCH}.videoId`;
export const PLAY_PLAYLIST_ID = `${PLAY_WATCH}.playlistId`;
export const HEADER_DETAIL = "header.musicDetailHeaderRenderer";

@@ -56,5 +59,7 @@ export const DESCRIPTION_SHELF = "musicDescriptionShelfRenderer";

export const FEEDBACK_TOKEN = "feedbackEndpoint.feedbackToken";
export const BADGE_PATH = "0.musicInlineBadgeRenderer.accessibilityData.accessibilityData.label";
export const SINGLE_BADGE_PATH = "musicInlineBadgeRenderer.accessibilityData.accessibilityData.label";
export const BADGE_PATH = `0.${SINGLE_BADGE_PATH}`;
export const BADGE_LABEL = `badges.${BADGE_PATH}`;
export const SUBTITLE_BADGE_LABEL = `subtitleBadges.${BADGE_PATH}`;
export const SINGLE_BADGE_LABEL = `subtitleBadge.0.${SINGLE_BADGE_PATH}`;
export const CATEGORY_TITLE = "musicNavigationButtonRenderer.buttonText.runs";

@@ -71,2 +76,4 @@ export const CATEGORY_PARAMS = "musicNavigationButtonRenderer.clickCommand.browseEndpoint.params";

export const MRLITFC = "musicResponsiveListItemFlexColumnRenderer.text";
export const TWO_COLUMN_RESULTS = "twoColumnBrowseResultsRenderer";
export const RESPONSIVE_HEADER = "musicResponsiveHeaderRenderer";
export function find_object_by_key(objectList, key, nested, isKey = false) {

@@ -73,0 +80,0 @@ for (const item of objectList) {

@@ -1,24 +0,29 @@

import { BADGE_PATH, HEADER_DETAIL, MENU, NAVIGATION_PLAYLIST_ID, NAVIGATION_WATCH_PLAYLIST_ID, SUBTITLE, THUMBNAIL_CROPPED, TITLE_TEXT, } from "../nav.js";
import { DESCRIPTION_SHELF, SINGLE_BADGE_LABEL } from "../nav.js";
import { DESCRIPTION } from "../nav.js";
import { THUMBNAILS } from "../nav.js";
import { find_object_by_key } from "../nav.js";
import { PLAY_PLAYLIST_ID, SUBTITLE, TITLE_TEXT } from "../nav.js";
import { j, jo } from "../util.js";
import { parse_like_status, parse_song_runs, } from "./songs.js";
import { get_library_like_status, parse_song_artists_runs } from "./songs.js";
import { get_menu_playlists } from "./util.js";
export function parse_album_header(response) {
const header = j(response, HEADER_DETAIL);
const album_info = parse_song_runs(header.subtitle.runs.slice(2));
export function parse_album_header(header) {
const playButton = find_object_by_key(header.buttons, "musicPlayButtonRenderer")
.musicPlayButtonRenderer;
const album = {
...album_info,
...get_menu_playlists(header),
// the last header button
...get_menu_playlists({ menu: header.buttons.slice(-1)[0] }),
title: j(header, TITLE_TEXT),
album_type: j(header, SUBTITLE),
thumbnails: j(header, THUMBNAIL_CROPPED),
isExplicit: jo(header, "subtitleBadges", BADGE_PATH) != null,
description: null,
thumbnails: j(header, THUMBNAILS),
isExplicit: jo(header, SINGLE_BADGE_LABEL) != null,
trackCount: null,
duration: null,
audioPlaylistId: null,
likeStatus: null,
audioPlaylistId: jo(playButton, PLAY_PLAYLIST_ID),
description: j(header, "description", DESCRIPTION_SHELF, DESCRIPTION),
likeStatus: get_library_like_status({
menu: find_object_by_key(header.buttons, "menuRenderer"),
}),
artists: parse_song_artists_runs(header.straplineTextOne.runs),
year: j(header, "subtitle.runs", (header.subtitle.runs.length - 1).toString(), "text"),
};
if ("description" in header) {
album.description = header.description.runs[0].text;
}
if (header.secondSubtitle.runs.length > 1) {

@@ -31,13 +36,3 @@ album.trackCount = header.secondSubtitle.runs[0].text;

}
// add to library/uploaded
const menu = j(header, MENU);
const toplevel = menu.topLevelButtons;
album.audioPlaylistId =
jo(toplevel, "0.buttonRenderer", NAVIGATION_WATCH_PLAYLIST_ID) ??
jo(toplevel, "0.buttonRenderer", NAVIGATION_PLAYLIST_ID);
const service = jo(toplevel, "1.toggleButtonRenderer.defaultServiceEndpoint");
if (service) {
album.likeStatus = parse_like_status(service);
}
return album;
}
import STRINGS from "../locales/strings.js";
import { BADGE_LABEL, CAROUSEL, CAROUSEL_SUBTITLE, CAROUSEL_THUMBNAILS, CAROUSEL_TITLE, DESCRIPTION, DESCRIPTION_SHELF, MRLIR, MTRIR, NAVIGATION_BROWSE, NAVIGATION_BROWSE_ID, NAVIGATION_PAGE_TYPE, NAVIGATION_PLAYLIST_ID, NAVIGATION_VIDEO_ID, NAVIGATION_WATCH_PLAYLIST_ID, RUN_TEXT, SUBTITLE, SUBTITLE2, SUBTITLE_BADGE_LABEL, TEXT_RUN, TEXT_RUN_TEXT, TEXT_RUNS, THUMBNAIL_RENDERER, THUMBNAILS, TITLE, TITLE_TEXT, } from "../nav.js";
import { TAB_CONTENT } from "../nav.js";
import { BADGE_LABEL, CAROUSEL, CAROUSEL_SUBTITLE, CAROUSEL_THUMBNAILS, CAROUSEL_TITLE, DESCRIPTION, DESCRIPTION_SHELF, MRLIR, MTRIR, NAVIGATION_BROWSE, NAVIGATION_BROWSE_ID, NAVIGATION_PAGE_TYPE, NAVIGATION_PLAYLIST_ID, NAVIGATION_VIDEO_ID, NAVIGATION_WATCH_PLAYLIST_ID, RUN_TEXT, SUBTITLE, SUBTITLE2, SUBTITLE_BADGE_LABEL, TEXT_RUN, TEXT_RUN_TEXT, TEXT_RUNS, THUMBNAIL_RENDERER, THUMBNAILS, TITLE, TITLE_TEXT, TWO_COLUMN_RESULTS, } from "../nav.js";
import { get_option } from "../setup.js";

@@ -510,1 +511,8 @@ import { j, jo } from "../util.js";

}
export function parse_two_columns(json) {
const renderer = j(json, "contents", TWO_COLUMN_RESULTS);
return {
secondary: renderer.secondaryContents,
tab: j(renderer, TAB_CONTENT),
};
}

@@ -6,3 +6,3 @@ {

"name": "libmuse",
"version": "0.0.99",
"version": "0.0.100",
"description": "A library to interact with the YouTube Music (InnerTube) api.",

@@ -9,0 +9,0 @@ "tags": [

@@ -107,3 +107,3 @@ "use strict";

async function get_album(browseId, options = {}) {
const response = await (0, _request_js_1.request_json)("browse", {
const json = await (0, _request_js_1.request_json)("browse", {
data: {

@@ -114,10 +114,12 @@ browseId,

});
const results = (0, util_js_1.j)(response, nav_js_1.SINGLE_COLUMN_TAB, nav_js_1.SECTION_LIST_ITEM, nav_js_1.MUSIC_SHELF);
const carousel = (0, util_js_1.jo)(response, nav_js_1.SINGLE_COLUMN_TAB, nav_js_1.SECTION_LIST, "1", nav_js_1.CAROUSEL);
const header = (0, albums_js_1.parse_album_header)(response);
const { tab, secondary } = (0, browsing_js_1.parse_two_columns)(json);
const header = (0, albums_js_1.parse_album_header)((0, util_js_1.j)(tab, nav_js_1.SECTION_LIST_ITEM, nav_js_1.RESPONSIVE_HEADER));
const results = (0, util_js_1.j)(secondary, nav_js_1.SECTION_LIST_ITEM, nav_js_1.MUSIC_SHELF);
const carousel = (0, util_js_1.jo)(secondary, nav_js_1.SECTION_LIST, "1", nav_js_1.CAROUSEL);
const album = {
id: (0, browsing_js_1.find_context_param)(response, "browse_id"),
id: (0, browsing_js_1.find_context_param)(json, "browse_id"),
...header,
tracks: (0, playlists_js_1.parse_playlist_items)(results.contents),
other_versions: null,
duration_seconds: 0,
};

@@ -124,0 +126,0 @@ if (carousel != null) {

@@ -13,2 +13,3 @@ "use strict";

const errors_js_1 = require("../errors.js");
const browsing_js_2 = require("../parsers/browsing.js");
async function get_playlist_suggestions(playlistId, continuation, options = {}) {

@@ -19,3 +20,3 @@ const { signal, limit = 6 } = options;

const endpoint = "browse";
const continued_suggestions = await (0, continuations_js_1.get_continuations)(continuation, "musicShelfContinuation", limit, (params) => (0, _request_js_1.request_json)(endpoint, { data, params, signal }), data => (0, playlists_js_1.parse_playlist_items)(data), undefined, true);
const continued_suggestions = await (0, continuations_js_1.get_continuations)(continuation, "musicShelfContinuation", limit, (params) => (0, _request_js_1.request_json)(endpoint, { data, params, signal }), (data) => (0, playlists_js_1.parse_playlist_items)(data), undefined, true);
const suggestions = {

@@ -47,33 +48,22 @@ suggestions: continued_suggestions.items,

const json = await (0, _request_js_1.request_json)(endpoint, { data, signal });
const results = (0, util_js_1.j)(json, nav_js_1.SINGLE_COLUMN_TAB, nav_js_1.SECTION_LIST_ITEM, "musicPlaylistShelfRenderer");
const own_playlist = "musicEditablePlaylistDetailHeaderRenderer" in
json.header;
const header = own_playlist
? json.header.musicEditablePlaylistDetailHeaderRenderer.header
.musicDetailHeaderRenderer
: json.header.musicDetailHeaderRenderer;
const { tab, secondary } = (0, browsing_js_2.parse_two_columns)(json);
const results = (0, util_js_1.j)(secondary, nav_js_1.SECTION_LIST_ITEM, "musicPlaylistShelfRenderer");
const json_header = (0, util_js_1.j)(tab, nav_js_1.SECTION_LIST_ITEM);
const header = (0, util_js_1.jo)(json_header, "musicEditablePlaylistDetailHeaderRenderer.header.musicResponsiveHeaderRenderer") ?? (0, util_js_1.j)(json_header, "musicResponsiveHeaderRenderer");
const editHeader = (0, util_js_1.jo)(json_header, "musicEditablePlaylistDetailHeaderRenderer.editHeader.musicPlaylistEditHeaderRenderer");
const own_playlist = !!editHeader;
const run_count = header.subtitle.runs.length;
const trackCount = header.secondSubtitle.runs
? header.secondSubtitle.runs[0].text
: null;
const duration = header.secondSubtitle.runs && header.secondSubtitle.runs.length > 2
? header.secondSubtitle.runs[2].text
: null;
const secondRuns = header.secondSubtitle.runs;
const playlist = {
id: results.playlistId,
privacy: own_playlist
? json.header.musicEditablePlaylistDetailHeaderRenderer.editHeader
.musicPlaylistEditHeaderRenderer.privacy
: "PUBLIC",
privacy: own_playlist ? editHeader.privacy : "PUBLIC",
editable: own_playlist,
title: (0, util_js_1.j)(header, nav_js_1.TITLE_TEXT),
thumbnails: (0, util_js_1.j)(header, nav_js_1.THUMBNAIL_CROPPED),
description: (0, util_js_1.jo)(header, nav_js_1.DESCRIPTION),
thumbnails: (0, util_js_1.j)(header, nav_js_1.THUMBNAILS),
description: (0, util_js_1.jo)(header, "description", nav_js_1.DESCRIPTION_SHELF, nav_js_1.DESCRIPTION),
type: run_count > 0 ? (0, util_js_1.j)(header, nav_js_1.SUBTITLE) : null,
authors: run_count > 1
? (0, songs_js_1.parse_song_artists_runs)(header.subtitle.runs.slice(2, run_count >= 5 ? -2 : undefined))
: [],
year: run_count === 5 ? (0, util_js_1.j)(header, nav_js_1.SUBTITLE3) : null,
trackCount: trackCount,
duration,
authors: (0, songs_js_1.parse_song_artists_runs)(header.straplineTextOne.runs),
year: (0, util_js_1.j)(header, "subtitle.runs", (run_count - 1).toString(), "text"),
trackCount: secondRuns ? secondRuns[0].text : null,
duration: secondRuns && secondRuns.length > 2 ? secondRuns[2].text : null,
duration_seconds: 0,

@@ -88,3 +78,3 @@ tracks: (0, playlists_js_1.parse_playlist_items)(results.contents ?? []),

// suggestions and related are missing e.g. on liked songs
const section_list = (0, util_js_1.j)(json, nav_js_1.SINGLE_COLUMN_TAB, "sectionListRenderer");
const section_list = (0, util_js_1.j)(secondary, "sectionListRenderer");
if ("continuations" in section_list) {

@@ -91,0 +81,0 @@ let params = (0, continuations_js_1.get_continuation_params)(section_list);

"use strict";
// commonly used navigation paths
Object.defineProperty(exports, "__esModule", { value: true });
exports.THUMBNAIL_RENDERER = exports.SUBTITLE3 = exports.SUBTITLE2 = exports.SUBTITLE = exports.TEXT_RUN_TEXT = exports.TEXT_RUN = exports.TEXT_RUNS = exports.TITLE_TEXT = exports.TITLE = exports.FRAMEWORK_MUTATIONS = exports.CAROUSEL_THUMBNAILS = exports.CAROUSEL_SUBTITLE = exports.CAROUSEL_TITLE = exports.CAROUSEL_CONTAINER = exports.CAROUSEL_CONTENTS = exports.IMMERSIVE_CAROUSEL = exports.CAROUSEL = exports.DESCRIPTION = exports.DESCRIPTION_SHELF = exports.HEADER_DETAIL = exports.NAVIGATION_VIDEO_TYPE = exports.NAVIGATION_WATCH_PLAYLIST_ID = exports.NAVIGATION_PLAYLIST_ID = exports.NAVIGATION_VIDEO_ID = exports.NAVIGATION_PAGE_TYPE = exports.PAGE_TYPE = exports.NAVIGATION_PARAMS = exports.NAVIGATION_BROWSE_ID = exports.NAVIGATION_BROWSE = exports.PLAY_BUTTON = exports.MORE_BUTTON = exports.TOGGLE_MENU = exports.MENU_SERVICE = exports.MENU_LIKE_STATUS = exports.MENU_ITEMS = exports.MENU = exports.GRID_ITEMS = exports.GRID = exports.MUSIC_SHELF = exports.ITEM_SECTION = exports.SECTION_LIST_ITEM = exports.SECTION_LIST = exports.SINGLE_COLUMN_TAB = exports.SINGLE_COLUMN = exports.TAB_1_CONTENT = exports.TAB_CONTENT = exports.RUN_TEXT = exports.CONTENT = exports.THUMBNAILS = exports.THUMBNAIL = void 0;
exports.find_object_by_icon_name = exports.find_objects_by_key = exports.find_object_by_key = exports.MRLITFC = exports.MENU_PLAYLIST_ID = exports.SECTION_LIST_CONTINUATION = exports.TASTE_PROFILE_ARTIST = exports.TASTE_PROFILE_ITEMS = exports.MTCIR = exports.MTRIR = exports.MRLIR = exports.CATEGORY_COLOR = exports.CATEGORY_PARAMS = exports.CATEGORY_TITLE = exports.SUBTITLE_BADGE_LABEL = exports.BADGE_LABEL = exports.BADGE_PATH = exports.FEEDBACK_TOKEN = exports.THUMBNAIL_CROPPED = void 0;
exports.SUBTITLE = exports.TEXT_RUN_TEXT = exports.TEXT_RUN = exports.TEXT_RUNS = exports.TITLE_TEXT = exports.TITLE = exports.FRAMEWORK_MUTATIONS = exports.CAROUSEL_THUMBNAILS = exports.CAROUSEL_SUBTITLE = exports.CAROUSEL_TITLE = exports.CAROUSEL_CONTAINER = exports.CAROUSEL_CONTENTS = exports.IMMERSIVE_CAROUSEL = exports.CAROUSEL = exports.DESCRIPTION = exports.DESCRIPTION_SHELF = exports.HEADER_DETAIL = exports.PLAY_PLAYLIST_ID = exports.PLAY_VIDEO_ID = exports.PLAY_WATCH = exports.NAVIGATION_VIDEO_TYPE = exports.NAVIGATION_WATCH_PLAYLIST_ID = exports.NAVIGATION_PLAYLIST_ID = exports.NAVIGATION_VIDEO_ID = exports.NAVIGATION_PAGE_TYPE = exports.PAGE_TYPE = exports.NAVIGATION_PARAMS = exports.NAVIGATION_BROWSE_ID = exports.NAVIGATION_BROWSE = exports.PLAY_BUTTON = exports.MORE_BUTTON = exports.TOGGLE_MENU = exports.MENU_SERVICE = exports.MENU_LIKE_STATUS = exports.MENU_ITEMS = exports.MENU = exports.GRID_ITEMS = exports.GRID = exports.MUSIC_SHELF = exports.ITEM_SECTION = exports.SECTION_LIST_ITEM = exports.SECTION_LIST = exports.SINGLE_COLUMN_TAB = exports.SINGLE_COLUMN = exports.TAB_1_CONTENT = exports.TAB_CONTENT = exports.RUN_TEXT = exports.CONTENT = exports.THUMBNAILS = exports.THUMBNAIL = void 0;
exports.find_object_by_icon_name = exports.find_objects_by_key = exports.find_object_by_key = exports.RESPONSIVE_HEADER = exports.TWO_COLUMN_RESULTS = exports.MRLITFC = exports.MENU_PLAYLIST_ID = exports.SECTION_LIST_CONTINUATION = exports.TASTE_PROFILE_ARTIST = exports.TASTE_PROFILE_ITEMS = exports.MTCIR = exports.MTRIR = exports.MRLIR = exports.CATEGORY_COLOR = exports.CATEGORY_PARAMS = exports.CATEGORY_TITLE = exports.SINGLE_BADGE_LABEL = exports.SUBTITLE_BADGE_LABEL = exports.BADGE_LABEL = exports.BADGE_PATH = exports.SINGLE_BADGE_PATH = exports.FEEDBACK_TOKEN = exports.THUMBNAIL_CROPPED = exports.THUMBNAIL_RENDERER = exports.SUBTITLE3 = exports.SUBTITLE2 = void 0;
const util_js_1 = require("./util.js");

@@ -37,2 +37,5 @@ exports.THUMBNAIL = "thumbnail.thumbnails";

exports.NAVIGATION_VIDEO_TYPE = "watchEndpoint.watchEndpointMusicSupportedConfigs.watchEndpointMusicConfig.musicVideoType";
exports.PLAY_WATCH = "playNavigationEndpoint.watchEndpoint";
exports.PLAY_VIDEO_ID = `${exports.PLAY_WATCH}.videoId`;
exports.PLAY_PLAYLIST_ID = `${exports.PLAY_WATCH}.playlistId`;
exports.HEADER_DETAIL = "header.musicDetailHeaderRenderer";

@@ -60,5 +63,7 @@ exports.DESCRIPTION_SHELF = "musicDescriptionShelfRenderer";

exports.FEEDBACK_TOKEN = "feedbackEndpoint.feedbackToken";
exports.BADGE_PATH = "0.musicInlineBadgeRenderer.accessibilityData.accessibilityData.label";
exports.SINGLE_BADGE_PATH = "musicInlineBadgeRenderer.accessibilityData.accessibilityData.label";
exports.BADGE_PATH = `0.${exports.SINGLE_BADGE_PATH}`;
exports.BADGE_LABEL = `badges.${exports.BADGE_PATH}`;
exports.SUBTITLE_BADGE_LABEL = `subtitleBadges.${exports.BADGE_PATH}`;
exports.SINGLE_BADGE_LABEL = `subtitleBadge.0.${exports.SINGLE_BADGE_PATH}`;
exports.CATEGORY_TITLE = "musicNavigationButtonRenderer.buttonText.runs";

@@ -75,2 +80,4 @@ exports.CATEGORY_PARAMS = "musicNavigationButtonRenderer.clickCommand.browseEndpoint.params";

exports.MRLITFC = "musicResponsiveListItemFlexColumnRenderer.text";
exports.TWO_COLUMN_RESULTS = "twoColumnBrowseResultsRenderer";
exports.RESPONSIVE_HEADER = "musicResponsiveHeaderRenderer";
function find_object_by_key(objectList, key, nested, isKey = false) {

@@ -77,0 +84,0 @@ for (const item of objectList) {

@@ -5,24 +5,29 @@ "use strict";

const nav_js_1 = require("../nav.js");
const nav_js_2 = require("../nav.js");
const nav_js_3 = require("../nav.js");
const nav_js_4 = require("../nav.js");
const nav_js_5 = require("../nav.js");
const util_js_1 = require("../util.js");
const songs_js_1 = require("./songs.js");
const util_js_2 = require("./util.js");
function parse_album_header(response) {
const header = (0, util_js_1.j)(response, nav_js_1.HEADER_DETAIL);
const album_info = (0, songs_js_1.parse_song_runs)(header.subtitle.runs.slice(2));
function parse_album_header(header) {
const playButton = (0, nav_js_4.find_object_by_key)(header.buttons, "musicPlayButtonRenderer")
.musicPlayButtonRenderer;
const album = {
...album_info,
...(0, util_js_2.get_menu_playlists)(header),
title: (0, util_js_1.j)(header, nav_js_1.TITLE_TEXT),
album_type: (0, util_js_1.j)(header, nav_js_1.SUBTITLE),
thumbnails: (0, util_js_1.j)(header, nav_js_1.THUMBNAIL_CROPPED),
isExplicit: (0, util_js_1.jo)(header, "subtitleBadges", nav_js_1.BADGE_PATH) != null,
description: null,
// the last header button
...(0, util_js_2.get_menu_playlists)({ menu: header.buttons.slice(-1)[0] }),
title: (0, util_js_1.j)(header, nav_js_5.TITLE_TEXT),
album_type: (0, util_js_1.j)(header, nav_js_5.SUBTITLE),
thumbnails: (0, util_js_1.j)(header, nav_js_3.THUMBNAILS),
isExplicit: (0, util_js_1.jo)(header, nav_js_1.SINGLE_BADGE_LABEL) != null,
trackCount: null,
duration: null,
audioPlaylistId: null,
likeStatus: null,
audioPlaylistId: (0, util_js_1.jo)(playButton, nav_js_5.PLAY_PLAYLIST_ID),
description: (0, util_js_1.j)(header, "description", nav_js_1.DESCRIPTION_SHELF, nav_js_2.DESCRIPTION),
likeStatus: (0, songs_js_1.get_library_like_status)({
menu: (0, nav_js_4.find_object_by_key)(header.buttons, "menuRenderer"),
}),
artists: (0, songs_js_1.parse_song_artists_runs)(header.straplineTextOne.runs),
year: (0, util_js_1.j)(header, "subtitle.runs", (header.subtitle.runs.length - 1).toString(), "text"),
};
if ("description" in header) {
album.description = header.description.runs[0].text;
}
if (header.secondSubtitle.runs.length > 1) {

@@ -35,14 +40,4 @@ album.trackCount = header.secondSubtitle.runs[0].text;

}
// add to library/uploaded
const menu = (0, util_js_1.j)(header, nav_js_1.MENU);
const toplevel = menu.topLevelButtons;
album.audioPlaylistId =
(0, util_js_1.jo)(toplevel, "0.buttonRenderer", nav_js_1.NAVIGATION_WATCH_PLAYLIST_ID) ??
(0, util_js_1.jo)(toplevel, "0.buttonRenderer", nav_js_1.NAVIGATION_PLAYLIST_ID);
const service = (0, util_js_1.jo)(toplevel, "1.toggleButtonRenderer.defaultServiceEndpoint");
if (service) {
album.likeStatus = (0, songs_js_1.parse_like_status)(service);
}
return album;
}
exports.parse_album_header = parse_album_header;

@@ -6,5 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.find_context_param = exports.is_ranked = exports.__ = exports._ = exports.parse_watch_playlist = exports.parse_related_artist = exports.parse_playlist = exports.parse_trending = exports.parse_top_artist = exports.parse_top_video = exports.parse_top_song = exports.parse_video = exports.parse_song_flat = exports.parse_song = exports.parse_single = exports.parse_album = exports.parse_mood_or_genre = exports.parse_content_list = exports.parse_chart_contents = exports.parse_explore_contents = exports.parse_artist_contents = exports.parse_channel_contents = exports.parse_categories = exports.parse_mixed_content = exports.parse_mixed_item = exports.parse_moods = void 0;
exports.parse_two_columns = exports.find_context_param = exports.is_ranked = exports.__ = exports._ = exports.parse_watch_playlist = exports.parse_related_artist = exports.parse_playlist = exports.parse_trending = exports.parse_top_artist = exports.parse_top_video = exports.parse_top_song = exports.parse_video = exports.parse_song_flat = exports.parse_song = exports.parse_single = exports.parse_album = exports.parse_mood_or_genre = exports.parse_content_list = exports.parse_chart_contents = exports.parse_explore_contents = exports.parse_artist_contents = exports.parse_channel_contents = exports.parse_categories = exports.parse_mixed_content = exports.parse_mixed_item = exports.parse_moods = void 0;
const strings_js_1 = __importDefault(require("../locales/strings.js"));
const nav_js_1 = require("../nav.js");
const nav_js_2 = require("../nav.js");
const setup_js_1 = require("../setup.js");

@@ -21,3 +22,3 @@ const util_js_1 = require("../util.js");

moods.push({
name: (0, util_js_1.j)(renderer, nav_js_1.TEXT_RUN_TEXT),
name: (0, util_js_1.j)(renderer, nav_js_2.TEXT_RUN_TEXT),
selected: (0, util_js_1.j)(renderer, "isSelected"),

@@ -32,3 +33,3 @@ params: (0, util_js_1.j)(renderer, "navigationEndpoint.browseEndpoint.params"),

let item = null;
const page_type = (0, util_js_1.jo)(data, nav_js_1.TITLE, nav_js_1.NAVIGATION_PAGE_TYPE);
const page_type = (0, util_js_1.jo)(data, nav_js_2.TITLE, nav_js_2.NAVIGATION_PAGE_TYPE);
switch (page_type) {

@@ -38,3 +39,3 @@ case null:

// song or watch playlist
if ((0, util_js_1.jo)(data, nav_js_1.NAVIGATION_WATCH_PLAYLIST_ID) != null) {
if ((0, util_js_1.jo)(data, nav_js_2.NAVIGATION_WATCH_PLAYLIST_ID) != null) {
item = parse_watch_playlist(data);

@@ -83,7 +84,7 @@ }

let title = null, contents, browseId = null, subtitle = null, thumbnails = null, display = null;
if (nav_js_1.DESCRIPTION_SHELF in row) {
const results = (0, util_js_1.j)(row, nav_js_1.DESCRIPTION_SHELF);
if (nav_js_2.DESCRIPTION_SHELF in row) {
const results = (0, util_js_1.j)(row, nav_js_2.DESCRIPTION_SHELF);
// type = "description";
title = (0, util_js_1.j)(results, "header", nav_js_1.RUN_TEXT);
contents = (0, util_js_1.j)(results, nav_js_1.DESCRIPTION);
title = (0, util_js_1.j)(results, "header", nav_js_2.RUN_TEXT);
contents = (0, util_js_1.j)(results, nav_js_2.DESCRIPTION);
}

@@ -102,7 +103,7 @@ else {

else {
const carousel_title = (0, util_js_1.j)(results, nav_js_1.CAROUSEL_TITLE);
const carousel_title = (0, util_js_1.j)(results, nav_js_2.CAROUSEL_TITLE);
title = (0, util_js_1.j)(carousel_title, "text");
browseId = (0, util_js_1.jo)(carousel_title, nav_js_1.NAVIGATION_BROWSE_ID);
subtitle = (0, util_js_1.jo)(results, nav_js_1.CAROUSEL_SUBTITLE, "text");
thumbnails = (0, util_js_1.jo)(results, nav_js_1.CAROUSEL_THUMBNAILS);
browseId = (0, util_js_1.jo)(carousel_title, nav_js_2.NAVIGATION_BROWSE_ID);
subtitle = (0, util_js_1.jo)(results, nav_js_2.CAROUSEL_SUBTITLE, "text");
thumbnails = (0, util_js_1.jo)(results, nav_js_2.CAROUSEL_THUMBNAILS);
children = results["contents"];

@@ -112,3 +113,3 @@ }

for (const result of children) {
const data = (0, util_js_1.jo)(result, nav_js_1.MTRIR);
const data = (0, util_js_1.jo)(result, nav_js_2.MTRIR);
let item = null;

@@ -122,3 +123,3 @@ if (data != null) {

else {
const data = (0, util_js_1.j)(result, nav_js_1.MRLIR);
const data = (0, util_js_1.j)(result, nav_js_2.MRLIR);
display = "list";

@@ -152,3 +153,3 @@ item = parse_song_flat(data);

.filter((r) => "musicCarouselShelfRenderer" in r &&
(0, util_js_1.j)(r, `${nav_js_1.CAROUSEL}.${nav_js_1.CAROUSEL_TITLE}`).text == category_local)
(0, util_js_1.j)(r, `${nav_js_2.CAROUSEL}.${nav_js_2.CAROUSEL_TITLE}`).text == category_local)
.map((r) => r.musicCarouselShelfRenderer);

@@ -161,5 +162,5 @@ if (data.length > 0) {

};
if ("navigationEndpoint" in (0, util_js_1.j)(data[0], nav_js_1.CAROUSEL_TITLE)) {
category_obj.browseId = (0, util_js_1.j)(data[0], nav_js_1.CAROUSEL_TITLE, nav_js_1.NAVIGATION_BROWSE_ID);
category_obj.params = (0, util_js_1.jo)(data[0], nav_js_1.CAROUSEL_TITLE, nav_js_1.NAVIGATION_BROWSE, "params");
if ("navigationEndpoint" in (0, util_js_1.j)(data[0], nav_js_2.CAROUSEL_TITLE)) {
category_obj.browseId = (0, util_js_1.j)(data[0], nav_js_2.CAROUSEL_TITLE, nav_js_2.NAVIGATION_BROWSE_ID);
category_obj.params = (0, util_js_1.jo)(data[0], nav_js_2.CAROUSEL_TITLE, nav_js_2.NAVIGATION_BROWSE, "params");
}

@@ -199,3 +200,3 @@ category_obj.results = parse_content_list(data[0].contents, category_parser, category_key);

albums: [_("new albums"), parse_album],
songs: [_("top songs"), parse_top_song, nav_js_1.MRLIR],
songs: [_("top songs"), parse_top_song, nav_js_2.MRLIR],
moods: [

@@ -206,3 +207,3 @@ _("moods"),

],
trending: [_("trending"), parse_trending, nav_js_1.MRLIR],
trending: [_("trending"), parse_trending, nav_js_2.MRLIR],
videos: [_("new videos"), parse_top_video],

@@ -216,7 +217,7 @@ };

// In exceedingly rare cases, songs may contain both songs and videos
songs: [_("top songs"), parse_trending, nav_js_1.MRLIR],
songs: [_("top songs"), parse_trending, nav_js_2.MRLIR],
videos: [_("top videos"), parse_top_video],
genres: [_("genres"), parse_playlist],
artists: [_("top artists"), parse_top_artist, nav_js_1.MRLIR],
trending: [_("trending"), parse_trending, nav_js_1.MRLIR],
artists: [_("top artists"), parse_top_artist, nav_js_2.MRLIR],
trending: [_("trending"), parse_trending, nav_js_2.MRLIR],
};

@@ -226,3 +227,3 @@ return parse_categories(results, categories_data);

exports.parse_chart_contents = parse_chart_contents;
function parse_content_list(results, parse_func, key = nav_js_1.MTRIR) {
function parse_content_list(results, parse_func, key = nav_js_2.MTRIR) {
const contents = [];

@@ -261,9 +262,9 @@ for (const result of results) {

type: "album",
title: (0, util_js_1.j)(result, nav_js_1.TITLE_TEXT),
title: (0, util_js_1.j)(result, nav_js_2.TITLE_TEXT),
year: is_year ? year : null,
browseId: (0, util_js_1.j)(result, nav_js_1.TITLE, nav_js_1.NAVIGATION_BROWSE_ID),
browseId: (0, util_js_1.j)(result, nav_js_2.TITLE, nav_js_2.NAVIGATION_BROWSE_ID),
audioPlaylistId: playlistId,
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAIL_RENDERER),
isExplicit: (0, util_js_1.jo)(result, nav_js_1.SUBTITLE_BADGE_LABEL) != null,
album_type: (0, util_js_1.j)(result, nav_js_1.SUBTITLE),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAIL_RENDERER),
isExplicit: (0, util_js_1.jo)(result, nav_js_2.SUBTITLE_BADGE_LABEL) != null,
album_type: (0, util_js_1.j)(result, nav_js_2.SUBTITLE),
artists: runs,

@@ -287,8 +288,8 @@ libraryLikeStatus: (0, songs_js_2.get_library_like_status)(result),

type: "album",
title: (0, util_js_1.j)(result, nav_js_1.TITLE_TEXT),
title: (0, util_js_1.j)(result, nav_js_2.TITLE_TEXT),
year: is_year ? year : null,
browseId: (0, util_js_1.j)(result, nav_js_1.TITLE, nav_js_1.NAVIGATION_BROWSE_ID),
browseId: (0, util_js_1.j)(result, nav_js_2.TITLE, nav_js_2.NAVIGATION_BROWSE_ID),
audioPlaylistId: playlistId,
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAIL_RENDERER),
isExplicit: (0, util_js_1.jo)(result, nav_js_1.SUBTITLE_BADGE_LABEL) != null,
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAIL_RENDERER),
isExplicit: (0, util_js_1.jo)(result, nav_js_2.SUBTITLE_BADGE_LABEL) != null,
artists: runs,

@@ -304,7 +305,7 @@ album_type: null,

type: "song",
title: (0, util_js_1.j)(result, nav_js_1.TITLE_TEXT),
videoId: (0, util_js_1.j)(result, nav_js_1.NAVIGATION_VIDEO_ID),
playlistId: (0, util_js_1.jo)(result, nav_js_1.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAIL_RENDERER),
isExplicit: (0, util_js_1.jo)(result, nav_js_1.SUBTITLE_BADGE_LABEL) != null,
title: (0, util_js_1.j)(result, nav_js_2.TITLE_TEXT),
videoId: (0, util_js_1.j)(result, nav_js_2.NAVIGATION_VIDEO_ID),
playlistId: (0, util_js_1.jo)(result, nav_js_2.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAIL_RENDERER),
isExplicit: (0, util_js_1.jo)(result, nav_js_2.SUBTITLE_BADGE_LABEL) != null,
feedbackTokens: (0, songs_js_2.get_menu_tokens)(result),

@@ -323,7 +324,7 @@ likeStatus: (0, songs_js_2.get_menu_like_status)(result),

type: "flat-song",
title: (0, util_js_1.j)(columns[0], nav_js_1.TEXT_RUN_TEXT),
videoId: (0, util_js_1.jo)(columns[0], nav_js_1.TEXT_RUN, nav_js_1.NAVIGATION_VIDEO_ID),
title: (0, util_js_1.j)(columns[0], nav_js_2.TEXT_RUN_TEXT),
videoId: (0, util_js_1.jo)(columns[0], nav_js_2.TEXT_RUN, nav_js_2.NAVIGATION_VIDEO_ID),
artists: (0, songs_js_2.parse_song_artists)(data, 1),
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAILS),
isExplicit: (0, util_js_1.jo)(data, nav_js_1.BADGE_LABEL) != null,
thumbnails: (0, util_js_1.j)(data, nav_js_2.THUMBNAILS),
isExplicit: (0, util_js_1.jo)(data, nav_js_2.BADGE_LABEL) != null,
album: null,

@@ -334,6 +335,6 @@ views: null,

if (columns.length > 2 && columns[2] != null &&
"navigationEndpoint" in (0, util_js_1.j)(columns[2], nav_js_1.TEXT_RUN)) {
"navigationEndpoint" in (0, util_js_1.j)(columns[2], nav_js_2.TEXT_RUN)) {
song.album = {
name: (0, util_js_1.j)(columns[2], nav_js_1.TEXT_RUN_TEXT),
id: (0, util_js_1.j)(columns[2], nav_js_1.TEXT_RUN, nav_js_1.NAVIGATION_BROWSE_ID),
name: (0, util_js_1.j)(columns[2], nav_js_2.TEXT_RUN_TEXT),
id: (0, util_js_1.j)(columns[2], nav_js_2.TEXT_RUN, nav_js_2.NAVIGATION_BROWSE_ID),
};

@@ -352,7 +353,7 @@ }

type: "video",
title: (0, util_js_1.j)(result, nav_js_1.TITLE_TEXT),
videoId: (0, util_js_1.j)(result, nav_js_1.NAVIGATION_VIDEO_ID),
title: (0, util_js_1.j)(result, nav_js_2.TITLE_TEXT),
videoId: (0, util_js_1.j)(result, nav_js_2.NAVIGATION_VIDEO_ID),
artists: (0, songs_js_2.parse_song_artists_runs)(runs.slice(0, artists_len)),
playlistId: (0, util_js_1.jo)(result, nav_js_1.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAIL_RENDERER),
playlistId: (0, util_js_1.jo)(result, nav_js_2.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAIL_RENDERER),
views: runs[runs.length - 1].text,

@@ -365,16 +366,16 @@ likeStatus: (0, songs_js_2.get_menu_like_status)(result),

const title = (0, util_js_2.get_flex_column_item)(result, 0);
const title_run = (0, util_js_1.j)(title, nav_js_1.TEXT_RUN);
const title_run = (0, util_js_1.j)(title, nav_js_2.TEXT_RUN);
const rank = (0, util_js_1.j)(result, "customIndexColumn.musicCustomIndexColumnRenderer");
const album_run = (0, util_js_1.jo)((0, util_js_2.get_flex_column_item)(result, result.flexColumns.length - 1) ?? {}, nav_js_1.TEXT_RUN);
const album_run = (0, util_js_1.jo)((0, util_js_2.get_flex_column_item)(result, result.flexColumns.length - 1) ?? {}, nav_js_2.TEXT_RUN);
return {
type: "song",
title: (0, util_js_1.j)(title_run, "text"),
videoId: (0, util_js_1.jo)(title_run, nav_js_1.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(title_run, nav_js_1.NAVIGATION_BROWSE_ID),
videoId: (0, util_js_1.jo)(title_run, nav_js_2.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(title_run, nav_js_2.NAVIGATION_BROWSE_ID),
artists: (0, songs_js_2.parse_song_artists)(result, 1) ?? [],
playlistId: (0, util_js_1.jo)(title_run, nav_js_1.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAILS),
rank: (0, util_js_1.j)(rank, nav_js_1.TEXT_RUN_TEXT),
playlistId: (0, util_js_1.jo)(title_run, nav_js_2.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAILS),
rank: (0, util_js_1.j)(rank, nav_js_2.TEXT_RUN_TEXT),
change: (0, util_js_1.jo)(rank, "icon.iconType")?.split("_")[2] || null,
isExplicit: (0, util_js_1.jo)(result, nav_js_1.BADGE_LABEL) != null,
isExplicit: (0, util_js_1.jo)(result, nav_js_2.BADGE_LABEL) != null,
views: null,

@@ -389,4 +390,4 @@ duration: null,

name: (0, util_js_1.j)(album_run, "text"),
id: (0, util_js_1.jo)(album_run, nav_js_1.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(album_run, nav_js_1.NAVIGATION_BROWSE_ID),
id: (0, util_js_1.jo)(album_run, nav_js_2.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(album_run, nav_js_2.NAVIGATION_BROWSE_ID),
}

@@ -405,10 +406,10 @@ : null,

type: "video",
title: (0, util_js_1.j)(result, nav_js_1.TITLE_TEXT),
videoId: (0, util_js_1.jo)(result, nav_js_1.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(result, nav_js_1.NAVIGATION_BROWSE_ID),
title: (0, util_js_1.j)(result, nav_js_2.TITLE_TEXT),
videoId: (0, util_js_1.jo)(result, nav_js_2.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(result, nav_js_2.NAVIGATION_BROWSE_ID),
artists: (0, songs_js_2.parse_song_artists_runs)(runs.slice(0, artists_len)),
playlistId: (0, util_js_1.jo)(result, nav_js_1.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAIL_RENDERER),
playlistId: (0, util_js_1.jo)(result, nav_js_2.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAIL_RENDERER),
views: runs[runs.length - 1].text,
rank: rank ? (0, util_js_1.jo)(rank, nav_js_1.TEXT_RUN_TEXT) : null,
rank: rank ? (0, util_js_1.jo)(rank, nav_js_2.TEXT_RUN_TEXT) : null,
change: (rank && (0, util_js_1.jo)(rank, "icon.iconType")?.split("_")[2]) ?? null,

@@ -423,7 +424,7 @@ likeStatus: (0, songs_js_2.get_menu_like_status)(result),

type: "artist",
name: (0, util_js_1.j)((0, util_js_2.get_flex_column_item)(result, 0), nav_js_1.TEXT_RUN_TEXT),
browseId: (0, util_js_1.j)(result, nav_js_1.NAVIGATION_BROWSE_ID),
subscribers: (0, util_js_1.j)((0, util_js_2.get_flex_column_item)(result, 1), nav_js_1.TEXT_RUN_TEXT),
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAILS),
rank: (0, util_js_1.j)(rank, nav_js_1.TEXT_RUN_TEXT),
name: (0, util_js_1.j)((0, util_js_2.get_flex_column_item)(result, 0), nav_js_2.TEXT_RUN_TEXT),
browseId: (0, util_js_1.j)(result, nav_js_2.NAVIGATION_BROWSE_ID),
subscribers: (0, util_js_1.j)((0, util_js_2.get_flex_column_item)(result, 1), nav_js_2.TEXT_RUN_TEXT),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAILS),
rank: (0, util_js_1.j)(rank, nav_js_2.TEXT_RUN_TEXT),
change: (0, util_js_1.jo)(rank, "icon.iconType")?.split("_")[2] || null,

@@ -436,16 +437,16 @@ ...(0, songs_js_2.get_shuffle_and_radio_ids)(result),

const title = (0, util_js_2.get_flex_column_item)(result, 0);
const title_run = (0, util_js_1.j)(title, nav_js_1.TEXT_RUN);
const title_run = (0, util_js_1.j)(title, nav_js_2.TEXT_RUN);
const last_flex = (0, util_js_2.get_flex_column_item)(result, result.flexColumns.length - 1) ??
(0, util_js_2.get_flex_column_item)(result, result.flexColumns.length - 2);
const last_runs = (0, util_js_1.jo)(last_flex, nav_js_1.TEXT_RUNS);
const last_runs = (0, util_js_1.jo)(last_flex, nav_js_2.TEXT_RUNS);
const rank = (0, util_js_1.j)(result, "customIndexColumn.musicCustomIndexColumnRenderer");
const album_run = (0, util_js_1.jo)((0, util_js_2.get_flex_column_item)(result, result.flexColumns.length - 1) ?? {}, nav_js_1.TEXT_RUN);
const album_run = (0, util_js_1.jo)((0, util_js_2.get_flex_column_item)(result, result.flexColumns.length - 1) ?? {}, nav_js_2.TEXT_RUN);
const data = {
title: (0, util_js_1.j)(title_run, "text"),
videoId: (0, util_js_1.jo)(title_run, nav_js_1.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(title_run, nav_js_1.NAVIGATION_BROWSE_ID),
videoId: (0, util_js_1.jo)(title_run, nav_js_2.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(title_run, nav_js_2.NAVIGATION_BROWSE_ID),
artists: (0, songs_js_2.parse_song_artists)(result, 1, album_run ? undefined : -1) ?? [],
playlistId: (0, util_js_1.jo)(title_run, nav_js_1.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAILS),
rank: (0, util_js_1.j)(rank, nav_js_1.TEXT_RUN_TEXT),
playlistId: (0, util_js_1.jo)(title_run, nav_js_2.NAVIGATION_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(result, nav_js_2.THUMBNAILS),
rank: (0, util_js_1.j)(rank, nav_js_2.TEXT_RUN_TEXT),
change: (0, util_js_1.jo)(rank, "icon.iconType")?.split("_")[2] || null,

@@ -455,3 +456,3 @@ year: null,

duration_seconds: null,
isExplicit: (0, util_js_1.jo)(result, nav_js_1.BADGE_LABEL) != null,
isExplicit: (0, util_js_1.jo)(result, nav_js_2.BADGE_LABEL) != null,
views: null,

@@ -470,4 +471,4 @@ feedbackTokens: (0, songs_js_2.get_menu_tokens)(result),

name: (0, util_js_1.j)(album_run, "text"),
id: (0, util_js_1.jo)(album_run, nav_js_1.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(album_run, nav_js_1.NAVIGATION_BROWSE_ID),
id: (0, util_js_1.jo)(album_run, nav_js_2.NAVIGATION_VIDEO_ID) ??
(0, util_js_1.j)(album_run, nav_js_2.NAVIGATION_BROWSE_ID),
}

@@ -492,5 +493,5 @@ : null,

type: "playlist",
title: (0, util_js_1.j)(data, nav_js_1.TITLE_TEXT),
playlistId: (0, util_js_1.j)(data, nav_js_1.TITLE, nav_js_1.NAVIGATION_BROWSE_ID).slice(2),
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAIL_RENDERER),
title: (0, util_js_1.j)(data, nav_js_2.TITLE_TEXT),
playlistId: (0, util_js_1.j)(data, nav_js_2.TITLE, nav_js_2.NAVIGATION_BROWSE_ID).slice(2),
thumbnails: (0, util_js_1.j)(data, nav_js_2.THUMBNAIL_RENDERER),
songs: has_data && has_songs

@@ -512,4 +513,4 @@ ? (0, util_js_1.j)(subtitles[subtitles.length - 1], "text")

if (subtitle.runs.length == 3 &&
(0, util_js_1.j)(data, nav_js_1.SUBTITLE2).match(/\d+ /)) {
playlist.count = (0, util_js_1.j)(data, nav_js_1.SUBTITLE2);
(0, util_js_1.j)(data, nav_js_2.SUBTITLE2).match(/\d+ /)) {
playlist.count = (0, util_js_1.j)(data, nav_js_2.SUBTITLE2);
// TODO: why are we getting "author" 2 times?

@@ -523,9 +524,9 @@ playlist.author = (0, songs_js_2.parse_song_artists_runs)(subtitle.runs.slice(0, 1));

function parse_related_artist(data) {
const subscribers = (0, util_js_1.jo)(data, nav_js_1.SUBTITLE2);
const subscribers = (0, util_js_1.jo)(data, nav_js_2.SUBTITLE2);
return {
type: "artist",
name: (0, util_js_1.j)(data, nav_js_1.TITLE_TEXT),
browseId: (0, util_js_1.j)(data, nav_js_1.TITLE, nav_js_1.NAVIGATION_BROWSE_ID),
name: (0, util_js_1.j)(data, nav_js_2.TITLE_TEXT),
browseId: (0, util_js_1.j)(data, nav_js_2.TITLE, nav_js_2.NAVIGATION_BROWSE_ID),
subscribers,
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAIL_RENDERER),
thumbnails: (0, util_js_1.j)(data, nav_js_2.THUMBNAIL_RENDERER),
...(0, songs_js_2.get_shuffle_and_radio_ids)(data),

@@ -538,5 +539,5 @@ };

type: "watch-playlist",
title: (0, util_js_1.j)(data, nav_js_1.TITLE_TEXT),
playlistId: (0, util_js_1.j)(data, nav_js_1.NAVIGATION_WATCH_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAIL_RENDERER),
title: (0, util_js_1.j)(data, nav_js_2.TITLE_TEXT),
playlistId: (0, util_js_1.j)(data, nav_js_2.NAVIGATION_WATCH_PLAYLIST_ID),
thumbnails: (0, util_js_1.j)(data, nav_js_2.THUMBNAIL_RENDERER),
...(0, songs_js_2.get_shuffle_and_radio_ids)(data),

@@ -573,1 +574,9 @@ };

exports.find_context_param = find_context_param;
function parse_two_columns(json) {
const renderer = (0, util_js_1.j)(json, "contents", nav_js_2.TWO_COLUMN_RESULTS);
return {
secondary: renderer.secondaryContents,
tab: (0, util_js_1.j)(renderer, nav_js_1.TAB_CONTENT),
};
}
exports.parse_two_columns = parse_two_columns;

@@ -41,2 +41,3 @@ import { AlbumHeader } from "../parsers/albums.js";

other_versions: ParsedAlbum[] | null;
duration_seconds: number;
}

@@ -43,0 +44,0 @@ export declare function get_album(browseId: string, options?: AbortOptions): Promise<AlbumResult>;

@@ -31,2 +31,5 @@ export declare const THUMBNAIL = "thumbnail.thumbnails";

export declare const NAVIGATION_VIDEO_TYPE = "watchEndpoint.watchEndpointMusicSupportedConfigs.watchEndpointMusicConfig.musicVideoType";
export declare const PLAY_WATCH = "playNavigationEndpoint.watchEndpoint";
export declare const PLAY_VIDEO_ID: string;
export declare const PLAY_PLAYLIST_ID: string;
export declare const HEADER_DETAIL = "header.musicDetailHeaderRenderer";

@@ -54,5 +57,7 @@ export declare const DESCRIPTION_SHELF = "musicDescriptionShelfRenderer";

export declare const FEEDBACK_TOKEN = "feedbackEndpoint.feedbackToken";
export declare const BADGE_PATH = "0.musicInlineBadgeRenderer.accessibilityData.accessibilityData.label";
export declare const SINGLE_BADGE_PATH = "musicInlineBadgeRenderer.accessibilityData.accessibilityData.label";
export declare const BADGE_PATH: string;
export declare const BADGE_LABEL: string;
export declare const SUBTITLE_BADGE_LABEL: string;
export declare const SINGLE_BADGE_LABEL: string;
export declare const CATEGORY_TITLE = "musicNavigationButtonRenderer.buttonText.runs";

@@ -69,2 +74,4 @@ export declare const CATEGORY_PARAMS = "musicNavigationButtonRenderer.clickCommand.browseEndpoint.params";

export declare const MRLITFC = "musicResponsiveListItemFlexColumnRenderer.text";
export declare const TWO_COLUMN_RESULTS = "twoColumnBrowseResultsRenderer";
export declare const RESPONSIVE_HEADER = "musicResponsiveHeaderRenderer";
interface ObjectWithNested {

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

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

import { ArtistRun } from "../mod.js";
import { AlbumType } from "./browsing.js";
import { LikeStatus, SongRuns } from "./songs.js";
import { LikeStatus } from "./songs.js";
import { MenuPlaylists, Thumbnail } from "./util.js";
export type AlbumHeaderExtends = SongRuns & MenuPlaylists;
export interface AlbumHeader extends AlbumHeaderExtends {
export interface AlbumHeader extends MenuPlaylists {
title: string;

@@ -15,3 +15,5 @@ album_type: AlbumType;

likeStatus: LikeStatus | null;
artists: ArtistRun[];
year: string | null;
}
export declare function parse_album_header(response: any): AlbumHeader;
export declare function parse_album_header(header: any): AlbumHeader;

@@ -166,2 +166,6 @@ import STRINGS from "../locales/strings.js";

export declare function find_context_param(json: any, key: string): any;
export declare function parse_two_columns(json: any): {
secondary: any;
tab: any;
};
export {};
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