mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-06 04:32:40 +00:00
Fix music info extraction
This commit is contained in:
@@ -212,13 +212,14 @@ export async function video_basic_info(url: string, options: InfoOptions = {}):
|
|||||||
if (musicInfo) {
|
if (musicInfo) {
|
||||||
musicInfo.forEach((x: any) => {
|
musicInfo.forEach((x: any) => {
|
||||||
if (!x.metadataRowRenderer) return;
|
if (!x.metadataRowRenderer) return;
|
||||||
if (x.metadataRowRenderer.title.simpleText.toLowerCase() === 'song') {
|
const title = x.metadataRowRenderer.title.simpleText ?? x.metadataRowRenderer.title.runs[0].text;
|
||||||
|
if (title.toLowerCase() === 'song') {
|
||||||
music.push({});
|
music.push({});
|
||||||
music[music.length - 1].song =
|
music[music.length - 1].song =
|
||||||
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
||||||
} else if (music.length === 0) return;
|
} else if (music.length === 0) return;
|
||||||
else
|
else
|
||||||
music[music.length - 1][x.metadataRowRenderer.title.simpleText.toLowerCase()] =
|
music[music.length - 1][title.toLowerCase()] =
|
||||||
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user