refactor: clean up, fix & remove outdated code (#228)

* dev: refactor and remove redundant code

* docs(music): update `Library` API ref

* docs: update examples

* chore: update lock file
This commit is contained in:
LuanRT
2022-11-06 03:32:16 -03:00
committed by GitHub
parent 1eda93ee08
commit aa334aacbd
50 changed files with 2006 additions and 2403 deletions

View File

@@ -54,14 +54,14 @@ class PlaylistPanelVideo extends YTNode {
seconds: timeToSeconds(new Text(data.lengthText).toString())
};
const album = new Text(data.longBylineText).runs?.find((run: any) => run.endpoint?.browse?.id.startsWith('MPR'));
const artists = new Text(data.longBylineText).runs?.filter((run: any) => run.endpoint?.browse?.id.startsWith('UC'));
const album = new Text(data.longBylineText).runs?.find((run: any) => run.endpoint?.payload?.browseId?.startsWith('MPR'));
const artists = new Text(data.longBylineText).runs?.filter((run: any) => run.endpoint?.payload?.browseId?.startsWith('UC'));
this.author = new Text(data.shortBylineText).toString();
if (album) {
this.album = {
id: (album as TextRun).endpoint?.browse?.id,
id: (album as TextRun).endpoint?.payload?.browseId,
name: (album as TextRun).text,
year: new Text(data.longBylineText).runs?.slice(-1)[0].text,
endpoint: (album as TextRun).endpoint
@@ -71,7 +71,7 @@ class PlaylistPanelVideo extends YTNode {
if (artists) {
this.artists = artists.map((artist) => ({
name: (artist as TextRun).text,
channel_id: (artist as TextRun).endpoint?.browse?.id,
channel_id: (artist as TextRun).endpoint?.payload?.browseId,
endpoint: (artist as TextRun).endpoint
}));
}