Skip to content

Commit 199aac3

Browse files
committed
feat(mixins2/browse/home): implement moods, thumbnails, continuations
and stub out `content`
1 parent d1b405a commit 199aac3

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

src/mixins2/browse/home.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
import { request_json } from "../../mixins/_request.ts";
22

3+
import { RawJSON } from "../../parsers2/types.d.ts";
34
import { 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
}

0 commit comments

Comments
 (0)