fix(ytmusic): fix music#getLyrics() & music#getUpNext()

These were broken due to recent changes in the parser — both should be fixed now. Note that `music#getRelated()` is still broken.
This commit is contained in:
LuanRT
2022-07-30 05:37:23 -03:00
parent c66940ae65
commit 4d332402db
4 changed files with 57 additions and 38 deletions

View File

@@ -21,8 +21,8 @@ class PlaylistPanelVideo extends YTNode {
seconds: timeToSeconds(new Text(data.lengthText).toString())
};
const album = new Text(data.longBylineText).runs.find((run) => run.endpoint?.browse?.id.startsWith('MPR'));
const artists = new Text(data.longBylineText).runs.filter((run) => run.endpoint?.browse?.id.startsWith('UC'));
const album = new Text(data.longBylineText).runs?.find((run) => run.endpoint?.browse?.id.startsWith('MPR'));
const artists = new Text(data.longBylineText).runs?.filter((run) => run.endpoint?.browse?.id.startsWith('UC'));
this.author = new Text(data.shortBylineText).toString();
@@ -35,11 +35,13 @@ class PlaylistPanelVideo extends YTNode {
};
}
this.artists = artists.map((artist) => ({
name: artist.text,
channel_id: artist.endpoint?.browse.id,
endpoint: artist.endpoint
}));
if (artists) {
this.artists = artists.map((artist) => ({
name: artist.text,
channel_id: artist.endpoint?.browse.id,
endpoint: artist.endpoint
}));
}
this.badges = Parser.parse(data.badges);
this.menu = Parser.parse(data.menu);

View File

@@ -6,7 +6,7 @@ class SingleColumnMusicWatchNextResults extends YTNode {
constructor(data) {
super();
return Parser.parse(data);
this.contents = Parser.parse(data);
}
}

View File

@@ -6,7 +6,7 @@ class Tabbed extends YTNode {
constructor(data) {
super();
return Parser.parse(data);
this.contents = Parser.parse(data);
}
}