refactor(Music#getRelated): Return page contents directy

This commit is contained in:
LuanRT
2024-04-19 16:22:21 -03:00
parent 064436cef3
commit 1ec2ea85e2

View File

@@ -278,7 +278,7 @@ export default class Music {
* Retrieves related content.
* @param video_id - The video id.
*/
async getRelated(video_id: string): Promise<ObservedArray<MusicCarouselShelf | MusicDescriptionShelf>> {
async getRelated(video_id: string): Promise<SectionList | Message> {
throwIfMissing({ video_id });
const response = await this.#actions.execute(
@@ -297,9 +297,9 @@ export default class Music {
if (!page.contents)
throw new InnertubeError('Unexpected response', page);
const shelves = page.contents.item().as(SectionList).contents.as(MusicCarouselShelf, MusicDescriptionShelf);
const contents = page.contents.item().as(SectionList, Message);
return shelves;
return contents;
}
/**