patch: add comments

This commit is contained in:
SAROND 2024-01-15 19:53:02 +04:00
parent 6ed8230448
commit b428f87321
2 changed files with 15 additions and 0 deletions

View File

@ -502,6 +502,11 @@ export default class YTMusic {
return songs.map(VideoParser.parsePlaylistVideo)
}
/**
* Get content for the home page.
*
* @returns Mixed HomePageContent
*/
public async getHome(): Promise<HomePageContent[]> {
const results: HomePageContent[] = []
const page = await this.constructRequest("browse", { browseId: FE_MUSIC_HOME })

View File

@ -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 {
const key = Object.keys(data)[0]
if (!key) throw new Error("Invalid content")