Skip to content

Commit b428f87

Browse files
committed
patch: add comments
1 parent 6ed8230 commit b428f87

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/YTMusic.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ export default class YTMusic {
502502
return songs.map(VideoParser.parsePlaylistVideo)
503503
}
504504

505+
/**
506+
* Get content for the home page.
507+
*
508+
* @returns Mixed HomePageContent
509+
*/
505510
public async getHome(): Promise<HomePageContent[]> {
506511
const results: HomePageContent[] = []
507512
const page = await this.constructRequest("browse", { browseId: FE_MUSIC_HOME })

src/parsers/Parser.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ export default class Parser {
3636
}
3737
}
3838

39+
/**
40+
* Parses mixed content data into a structured `HomePageContent` object.
41+
*
42+
* This static method takes raw data of mixed content types and attempts to parse it into a
43+
* more structured format suitable for use as home page content. It supports multiple content
44+
* types such as music descriptions, artists, albums, playlists, and songs.
45+
*
46+
* @param {any} data - The raw data to be parsed.
47+
* @returns {HomePageContent | null} A `HomePageContent` object if parsing is successful, or null otherwise.
48+
*/
3949
public static parseMixedContent(data: any): HomePageContent | null {
4050
const key = Object.keys(data)[0]
4151
if (!key) throw new Error("Invalid content")

0 commit comments

Comments
 (0)