Skip to content

Commit

Permalink
feat: parse top videos in explore
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed Apr 2, 2024
1 parent cc0cd8f commit fda6e76
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions parsers/browsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ export function parse_explore_contents(results: any[]) {
"musicNavigationButtonRenderer",
],
trending: [_("trending"), parse_trending, MRLIR],
videos: [_("new videos"), parse_top_video],
} satisfies CategoryMap;

return parse_categories(results, categories_data);
Expand Down Expand Up @@ -630,7 +631,7 @@ export function parse_top_video(result: any): Ranked<ParsedVideo> {
const runs = result.subtitle.runs;
const artists_len = get_dot_separator_index(runs);

const rank = j(result, "customIndexColumn.musicCustomIndexColumnRenderer");
const rank = jo(result, "customIndexColumn.musicCustomIndexColumnRenderer");

return {
type: "video",
Expand All @@ -641,8 +642,8 @@ export function parse_top_video(result: any): Ranked<ParsedVideo> {
playlistId: jo(result, NAVIGATION_PLAYLIST_ID),
thumbnails: j(result, THUMBNAIL_RENDERER),
views: runs[runs.length - 1].text,
rank: j(rank, TEXT_RUN_TEXT),
change: jo(rank, "icon.iconType")?.split("_")[2] || null,
rank: rank ? jo(rank, TEXT_RUN_TEXT) : null,
change: (rank && jo(rank, "icon.iconType")?.split("_")[2]) ?? null,
likeStatus: get_menu_like_status(result),
};
}
Expand Down

0 comments on commit fda6e76

Please sign in to comment.