File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { request_json } from "../../mixins/_request.ts" ;
22
3+ import { RawJSON } from "../../parsers2/types.d.ts" ;
34import { parse_single_column_browse_results_renderer } from "../../parsers2/tabs/mod.ts" ;
5+ import { parse_background , Thumbnail } from "../../parsers2/thumbnail/mod.ts" ;
6+ import { parse_mood_chips } from "../../parsers2/chips/mod.ts" ;
7+ import { ParseMoodChipResult } from "../../parsers2/chips/mood.ts" ;
8+ import { parse_section_list } from "../../parsers2/list/mod.ts" ;
49
5- export async function get_home ( ) {
10+ export type MoodChip = ParseMoodChipResult ;
11+
12+ export interface Home {
13+ moods : MoodChip [ ] ;
14+ thumbnails : Thumbnail [ ] ;
15+ continuation : string | null ;
16+ content : RawJSON ;
17+ }
18+
19+ export async function get_home ( ) : Promise < Home > {
620 const json = await request_json ( "browse" , {
721 data : { browseId : "FEmusic_home" } ,
822 } ) ;
923
24+ const background = parse_background ( json ) ;
1025 const tab = parse_single_column_browse_results_renderer ( json . contents ) . tab ;
26+ const section_list = parse_section_list ( tab . content ) ;
27+
28+ const moods = parse_mood_chips ( section_list . header ) ;
1129
12- return tab ;
30+ return {
31+ moods,
32+ thumbnails : background . thumbnails ,
33+ continuation : section_list . nextContinuation ,
34+ content : section_list . contents ,
35+ } ;
1336}
You can’t perform that action at this time.
0 commit comments