Skip to content

Commit

Permalink
fix sometimes album not getting audioPlaylistId
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed Jul 26, 2023
1 parent fdc535b commit 769dbae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { get_option, get_song, setup } from "./mod.ts";
import { get_explore, get_option, setup } from "./mod.ts";
import { FetchClient, RequestInit } from "./request.ts";
import { DenoFileStore } from "./store.ts";
import { debug } from "./util.ts";
Expand Down Expand Up @@ -119,7 +119,7 @@ auth.addEventListener("requires-login", (event) => {
// console.log(await data.text());
// });

get_song("tgHDCz4U1JY")
get_explore()
// get_playlist("PLCwfwQhurMOukOqbFmYRidZ81ng_2iSUE")
// .then((data) => {
// return get_queue(null, data.playlistId, { autoplay: true });
Expand Down
9 changes: 6 additions & 3 deletions parsers/browsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,20 @@ export function parse_album(result: any): ParsedAlbum {
runs.pop();
}

const endpoint = j(
const playlistId = jo(
result,
"thumbnailOverlay.musicItemThumbnailOverlayRenderer.content.musicPlayButtonRenderer.playNavigationEndpoint.watchEndpoint",
);
)?.playlistId ?? j(
result,
"thumbnailOverlay.musicItemThumbnailOverlayRenderer.content.musicPlayButtonRenderer.playNavigationEndpoint.watchPlaylistEndpoint",
).playlistId;

return {
type: "album",
title: j(result, TITLE_TEXT),
year: is_year ? year : null,
browseId: j(result, TITLE, NAVIGATION_BROWSE_ID),
audioPlaylistId: j(endpoint, "playlistId"),
audioPlaylistId: playlistId,
thumbnails: j(result, THUMBNAIL_RENDERER),
isExplicit: jo(result, SUBTITLE_BADGE_LABEL) != null,
album_type: j(result, SUBTITLE),
Expand Down

0 comments on commit 769dbae

Please sign in to comment.