Comparing version 0.0.94 to 0.0.95
@@ -5,2 +5,3 @@ import STRINGS from "../locales/strings.js"; | ||
import { j, jo } from "../util.js"; | ||
import { get_buttons_like_status } from "./songs.js"; | ||
import { get_library_like_status, get_menu_like_status, get_menu_tokens, get_shuffle_and_radio_ids, parse_song_artists, parse_song_artists_runs, parse_song_runs, } from "./songs.js"; | ||
@@ -293,2 +294,3 @@ import { color_to_hex, get_dot_separator_index, get_flex_column_item, } from "./util.js"; | ||
views: null, | ||
likeStatus: get_buttons_like_status(data), | ||
}; | ||
@@ -295,0 +297,0 @@ if (columns.length > 2 && columns[2] != null && |
@@ -1,4 +0,4 @@ | ||
import { BADGE_LABEL, MENU_ITEMS, MENU_LIKE_STATUS, MENU_SERVICE, MRLIR, NAVIGATION_VIDEO_TYPE, PLAY_BUTTON, TEXT_RUN_TEXT, THUMBNAILS, TOGGLE_MENU, } from "../nav.js"; | ||
import { BADGE_LABEL, MENU_ITEMS, MENU_SERVICE, MRLIR, NAVIGATION_VIDEO_TYPE, PLAY_BUTTON, TEXT_RUN_TEXT, THUMBNAILS, TOGGLE_MENU, } from "../nav.js"; | ||
import { j, jo } from "../util.js"; | ||
import { parse_song_album, parse_song_artists, parse_song_menu_tokens, } from "./songs.js"; | ||
import { get_buttons_like_status, parse_song_album, parse_song_artists, parse_song_menu_tokens, } from "./songs.js"; | ||
import { get_fixed_column_item, get_item_text, parse_duration, } from "./util.js"; | ||
@@ -12,3 +12,3 @@ export const parse_playlist_items = (results, menu_entries) => { | ||
const data = result[MRLIR]; | ||
let videoId = null, setVideoId = null, like = null, feedback_tokens = null; | ||
let videoId = null, setVideoId = null, feedback_tokens = null; | ||
// if the item has a menu, find its setVideoId | ||
@@ -33,7 +33,5 @@ if ("menu" in data) { | ||
videoId = j(play, "playNavigationEndpoint.watchEndpoint.videoId"); | ||
if ("menu" in data) { | ||
like = jo(data, MENU_LIKE_STATUS); | ||
} | ||
} | ||
} | ||
const likeStatus = get_buttons_like_status(data); | ||
const title = get_item_text(data, 0); | ||
@@ -72,3 +70,3 @@ if (title == "Song deleted") { | ||
album, | ||
likeStatus: like, | ||
likeStatus, | ||
thumbnails, | ||
@@ -75,0 +73,0 @@ isAvailable, |
import { FEEDBACK_TOKEN, find_object_by_icon_name, MENU_ITEMS, NAVIGATION_BROWSE_ID, NAVIGATION_PAGE_TYPE, NAVIGATION_WATCH_PLAYLIST_ID, TOGGLE_MENU, } from "../nav.js"; | ||
import { MENU_LIKE_STATUS } from "../nav.js"; | ||
import { j, jo } from "../util.js"; | ||
@@ -128,2 +129,5 @@ import { _ } from "./browsing.js"; | ||
} | ||
export function get_buttons_like_status(item) { | ||
return jo(item, MENU_LIKE_STATUS); | ||
} | ||
export function get_shuffle_and_radio_ids(item) { | ||
@@ -130,0 +134,0 @@ const shuffle = find_object_by_icon_name(jo(item, MENU_ITEMS), "menuNavigationItemRenderer", "MUSIC_SHUFFLE"); |
@@ -6,3 +6,3 @@ { | ||
"name": "libmuse", | ||
"version": "0.0.94", | ||
"version": "0.0.95", | ||
"description": "A library to interact with the YouTube Music (InnerTube) api.", | ||
@@ -9,0 +9,0 @@ "tags": [ |
@@ -12,2 +12,3 @@ "use strict"; | ||
const songs_js_1 = require("./songs.js"); | ||
const songs_js_2 = require("./songs.js"); | ||
const util_js_2 = require("./util.js"); | ||
@@ -237,3 +238,3 @@ function parse_moods(results) { | ||
const subtitles = (0, util_js_1.j)(result, SUBTITLE_RUNS); | ||
const runs = (0, songs_js_1.parse_song_artists_runs)(subtitles.slice(2)); | ||
const runs = (0, songs_js_2.parse_song_artists_runs)(subtitles.slice(2)); | ||
const year = subtitles[subtitles.length - 1].text; | ||
@@ -255,4 +256,4 @@ const is_year = year.match(/^\d{4}$/); | ||
artists: runs, | ||
libraryLikeStatus: (0, songs_js_1.get_library_like_status)(result), | ||
...(0, songs_js_1.get_shuffle_and_radio_ids)(result), | ||
libraryLikeStatus: (0, songs_js_2.get_library_like_status)(result), | ||
...(0, songs_js_2.get_shuffle_and_radio_ids)(result), | ||
}; | ||
@@ -264,3 +265,3 @@ } | ||
const subtitles = (0, util_js_1.j)(result, SUBTITLE_RUNS); | ||
const runs = (0, songs_js_1.parse_song_artists_runs)(subtitles.slice(2)); | ||
const runs = (0, songs_js_2.parse_song_artists_runs)(subtitles.slice(2)); | ||
const year = subtitles[subtitles.length - 1].text; | ||
@@ -282,4 +283,4 @@ const is_year = year.match(/^\d{4}$/); | ||
album_type: null, | ||
libraryLikeStatus: (0, songs_js_1.get_library_like_status)(result), | ||
...(0, songs_js_1.get_shuffle_and_radio_ids)(result), | ||
libraryLikeStatus: (0, songs_js_2.get_library_like_status)(result), | ||
...(0, songs_js_2.get_shuffle_and_radio_ids)(result), | ||
}; | ||
@@ -296,5 +297,5 @@ } | ||
isExplicit: (0, util_js_1.jo)(result, nav_js_1.SUBTITLE_BADGE_LABEL) != null, | ||
feedbackTokens: (0, songs_js_1.get_menu_tokens)(result), | ||
likeStatus: (0, songs_js_1.get_menu_like_status)(result), | ||
...(0, songs_js_1.parse_song_runs)(result.subtitle.runs), | ||
feedbackTokens: (0, songs_js_2.get_menu_tokens)(result), | ||
likeStatus: (0, songs_js_2.get_menu_like_status)(result), | ||
...(0, songs_js_2.parse_song_runs)(result.subtitle.runs), | ||
}; | ||
@@ -312,3 +313,3 @@ } | ||
videoId: (0, util_js_1.jo)(columns[0], nav_js_1.TEXT_RUN, nav_js_1.NAVIGATION_VIDEO_ID), | ||
artists: (0, songs_js_1.parse_song_artists)(data, 1), | ||
artists: (0, songs_js_2.parse_song_artists)(data, 1), | ||
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAILS), | ||
@@ -318,2 +319,3 @@ isExplicit: (0, util_js_1.jo)(data, nav_js_1.BADGE_LABEL) != null, | ||
views: null, | ||
likeStatus: (0, songs_js_1.get_buttons_like_status)(data), | ||
}; | ||
@@ -340,7 +342,7 @@ if (columns.length > 2 && columns[2] != null && | ||
videoId: (0, util_js_1.j)(result, nav_js_1.NAVIGATION_VIDEO_ID), | ||
artists: (0, songs_js_1.parse_song_artists_runs)(runs.slice(0, artists_len)), | ||
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), | ||
views: runs[runs.length - 1].text, | ||
likeStatus: (0, songs_js_1.get_menu_like_status)(result), | ||
likeStatus: (0, songs_js_2.get_menu_like_status)(result), | ||
}; | ||
@@ -359,3 +361,3 @@ } | ||
(0, util_js_1.j)(title_run, nav_js_1.NAVIGATION_BROWSE_ID), | ||
artists: (0, songs_js_1.parse_song_artists)(result, 1) ?? [], | ||
artists: (0, songs_js_2.parse_song_artists)(result, 1) ?? [], | ||
playlistId: (0, util_js_1.jo)(title_run, nav_js_1.NAVIGATION_PLAYLIST_ID), | ||
@@ -379,4 +381,4 @@ thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAILS), | ||
: null, | ||
feedbackTokens: (0, songs_js_1.get_menu_tokens)(result), | ||
likeStatus: (0, songs_js_1.get_menu_like_status)(result), | ||
feedbackTokens: (0, songs_js_2.get_menu_tokens)(result), | ||
likeStatus: (0, songs_js_2.get_menu_like_status)(result), | ||
}; | ||
@@ -394,3 +396,3 @@ } | ||
(0, util_js_1.j)(result, nav_js_1.NAVIGATION_BROWSE_ID), | ||
artists: (0, songs_js_1.parse_song_artists_runs)(runs.slice(0, artists_len)), | ||
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), | ||
@@ -401,3 +403,3 @@ thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAIL_RENDERER), | ||
change: (0, util_js_1.jo)(rank, "icon.iconType")?.split("_")[2] || null, | ||
likeStatus: (0, songs_js_1.get_menu_like_status)(result), | ||
likeStatus: (0, songs_js_2.get_menu_like_status)(result), | ||
}; | ||
@@ -416,3 +418,3 @@ } | ||
change: (0, util_js_1.jo)(rank, "icon.iconType")?.split("_")[2] || null, | ||
...(0, songs_js_1.get_shuffle_and_radio_ids)(result), | ||
...(0, songs_js_2.get_shuffle_and_radio_ids)(result), | ||
}; | ||
@@ -433,3 +435,3 @@ } | ||
(0, util_js_1.j)(title_run, nav_js_1.NAVIGATION_BROWSE_ID), | ||
artists: (0, songs_js_1.parse_song_artists)(result, 1, album_run ? undefined : -1) ?? [], | ||
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), | ||
@@ -444,4 +446,4 @@ thumbnails: (0, util_js_1.j)(result, nav_js_1.THUMBNAILS), | ||
views: null, | ||
feedbackTokens: (0, songs_js_1.get_menu_tokens)(result), | ||
likeStatus: (0, songs_js_1.get_menu_like_status)(result), | ||
feedbackTokens: (0, songs_js_2.get_menu_tokens)(result), | ||
likeStatus: (0, songs_js_2.get_menu_like_status)(result), | ||
}; | ||
@@ -485,3 +487,3 @@ if (album_run) { | ||
authors: has_data | ||
? (0, songs_js_1.parse_song_artists_runs)(subtitles.slice(2, has_songs ? -1 : undefined)) | ||
? (0, songs_js_2.parse_song_artists_runs)(subtitles.slice(2, has_songs ? -1 : undefined)) | ||
: null, | ||
@@ -491,4 +493,4 @@ description: null, | ||
author: null, | ||
libraryLikeStatus: (0, songs_js_1.get_library_like_status)(data), | ||
...(0, songs_js_1.get_shuffle_and_radio_ids)(data), | ||
libraryLikeStatus: (0, songs_js_2.get_library_like_status)(data), | ||
...(0, songs_js_2.get_shuffle_and_radio_ids)(data), | ||
}; | ||
@@ -502,3 +504,3 @@ const subtitle = data.subtitle; | ||
// TODO: why are we getting "author" 2 times? | ||
playlist.author = (0, songs_js_1.parse_song_artists_runs)(subtitle.runs.slice(0, 1)); | ||
playlist.author = (0, songs_js_2.parse_song_artists_runs)(subtitle.runs.slice(0, 1)); | ||
} | ||
@@ -517,3 +519,3 @@ } | ||
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAIL_RENDERER), | ||
...(0, songs_js_1.get_shuffle_and_radio_ids)(data), | ||
...(0, songs_js_2.get_shuffle_and_radio_ids)(data), | ||
}; | ||
@@ -528,3 +530,3 @@ } | ||
thumbnails: (0, util_js_1.j)(data, nav_js_1.THUMBNAIL_RENDERER), | ||
...(0, songs_js_1.get_shuffle_and_radio_ids)(data), | ||
...(0, songs_js_2.get_shuffle_and_radio_ids)(data), | ||
}; | ||
@@ -531,0 +533,0 @@ } |
@@ -15,3 +15,3 @@ "use strict"; | ||
const data = result[nav_js_1.MRLIR]; | ||
let videoId = null, setVideoId = null, like = null, feedback_tokens = null; | ||
let videoId = null, setVideoId = null, feedback_tokens = null; | ||
// if the item has a menu, find its setVideoId | ||
@@ -36,7 +36,5 @@ if ("menu" in data) { | ||
videoId = (0, util_js_1.j)(play, "playNavigationEndpoint.watchEndpoint.videoId"); | ||
if ("menu" in data) { | ||
like = (0, util_js_1.jo)(data, nav_js_1.MENU_LIKE_STATUS); | ||
} | ||
} | ||
} | ||
const likeStatus = (0, songs_js_1.get_buttons_like_status)(data); | ||
const title = (0, util_js_2.get_item_text)(data, 0); | ||
@@ -75,3 +73,3 @@ if (title == "Song deleted") { | ||
album, | ||
likeStatus: like, | ||
likeStatus, | ||
thumbnails, | ||
@@ -78,0 +76,0 @@ isAvailable, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parse_like_status = exports.parse_format = exports.get_library_like_status = exports.parse_menu_library_like_status = exports.get_shuffle_and_radio_ids = exports.get_menu_like_status = exports.get_menu_tokens = exports.parse_song_menu_tokens = exports.parse_song_album = exports.parse_song_runs = exports.parse_song_artists_runs = exports.parse_song_artists = void 0; | ||
exports.parse_like_status = exports.parse_format = exports.get_library_like_status = exports.parse_menu_library_like_status = exports.get_shuffle_and_radio_ids = exports.get_buttons_like_status = exports.get_menu_like_status = exports.get_menu_tokens = exports.parse_song_menu_tokens = exports.parse_song_album = exports.parse_song_runs = exports.parse_song_artists_runs = exports.parse_song_artists = void 0; | ||
const nav_js_1 = require("../nav.js"); | ||
const nav_js_2 = require("../nav.js"); | ||
const util_js_1 = require("../util.js"); | ||
@@ -138,2 +139,6 @@ const browsing_js_1 = require("./browsing.js"); | ||
exports.get_menu_like_status = get_menu_like_status; | ||
function get_buttons_like_status(item) { | ||
return (0, util_js_1.jo)(item, nav_js_2.MENU_LIKE_STATUS); | ||
} | ||
exports.get_buttons_like_status = get_buttons_like_status; | ||
function get_shuffle_and_radio_ids(item) { | ||
@@ -140,0 +145,0 @@ const shuffle = (0, nav_js_1.find_object_by_icon_name)((0, util_js_1.jo)(item, nav_js_1.MENU_ITEMS), "menuNavigationItemRenderer", "MUSIC_SHUFFLE"); |
@@ -109,2 +109,3 @@ import STRINGS from "../locales/strings.js"; | ||
views: string | null; | ||
likeStatus: LikeStatus | null; | ||
} | ||
@@ -111,0 +112,0 @@ export declare function parse_song_flat(data: any): FlatSong; |
@@ -74,2 +74,3 @@ export interface AudioFormat extends BaseFormat { | ||
export declare function get_menu_like_status(item: any): LikeStatus | null; | ||
export declare function get_buttons_like_status(item: any): LikeStatus | null; | ||
export interface ShuffleAndRadioIds { | ||
@@ -76,0 +77,0 @@ shuffleId: string | null; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
888973
18296