patch: add comments
This commit is contained in:
parent
6ed8230448
commit
b428f87321
|
|
@ -502,6 +502,11 @@ export default class YTMusic {
|
||||||
return songs.map(VideoParser.parsePlaylistVideo)
|
return songs.map(VideoParser.parsePlaylistVideo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get content for the home page.
|
||||||
|
*
|
||||||
|
* @returns Mixed HomePageContent
|
||||||
|
*/
|
||||||
public async getHome(): Promise<HomePageContent[]> {
|
public async getHome(): Promise<HomePageContent[]> {
|
||||||
const results: HomePageContent[] = []
|
const results: HomePageContent[] = []
|
||||||
const page = await this.constructRequest("browse", { browseId: FE_MUSIC_HOME })
|
const page = await this.constructRequest("browse", { browseId: FE_MUSIC_HOME })
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,16 @@ export default class Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses mixed content data into a structured `HomePageContent` object.
|
||||||
|
*
|
||||||
|
* This static method takes raw data of mixed content types and attempts to parse it into a
|
||||||
|
* more structured format suitable for use as home page content. It supports multiple content
|
||||||
|
* types such as music descriptions, artists, albums, playlists, and songs.
|
||||||
|
*
|
||||||
|
* @param {any} data - The raw data to be parsed.
|
||||||
|
* @returns {HomePageContent | null} A `HomePageContent` object if parsing is successful, or null otherwise.
|
||||||
|
*/
|
||||||
public static parseMixedContent(data: any): HomePageContent | null {
|
public static parseMixedContent(data: any): HomePageContent | null {
|
||||||
const key = Object.keys(data)[0]
|
const key = Object.keys(data)[0]
|
||||||
if (!key) throw new Error("Invalid content")
|
if (!key) throw new Error("Invalid content")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue