mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-23 23:09:28 +00:00
feat(ytmusic): multiple video authors (#83)
Parse all `authors` from a music video. For legacy reasons, `author` key is kept returning the first entry. Definitions updated respectively.
This commit is contained in:
@@ -104,13 +104,13 @@ class MusicResponsiveListItem {
|
||||
this.views = this.#flex_columns[1].title.runs
|
||||
.find((run) => run.text.match(/(.*?) views/)).text;
|
||||
|
||||
const author = this.#flex_columns[1].title.runs.find((run) => run.endpoint.browse?.id.startsWith('UC'));
|
||||
const authors = this.#flex_columns[1].title.runs?.filter((run) => run.endpoint.browse?.id.startsWith('UC'));
|
||||
|
||||
author && (this.author = {
|
||||
authors && (this.authors = authors.map((author) => ({
|
||||
name: author.text,
|
||||
channel_id: author.endpoint.browse.id,
|
||||
endpoint: author.endpoint
|
||||
});
|
||||
}))) && (this.author = this.authors[0]);
|
||||
|
||||
const duration_text = this.#flex_columns[1].title.runs
|
||||
.find((run) => /^\d+$/.test(run.text.replace(/:/g, '')))?.text;
|
||||
|
||||
@@ -37,6 +37,11 @@ declare class MusicResponsiveListItem {
|
||||
channel_id: any;
|
||||
endpoint: any;
|
||||
};
|
||||
authors: {
|
||||
name: any;
|
||||
channel_id: any;
|
||||
endpoint: any;
|
||||
}[];
|
||||
name: any;
|
||||
subscribers: any;
|
||||
year: any;
|
||||
|
||||
Reference in New Issue
Block a user