api/youtube: fix youtube music metadata parsing

still pretty crappy tho
This commit is contained in:
wukko 2024-09-28 02:01:43 +06:00
parent 7d6fe34fa4
commit bf7a48a36c
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -243,11 +243,13 @@ export default async function(o) {
}
if (basicInfo?.short_description?.startsWith("Provided to YouTube by")) {
let descItems = basicInfo.short_description.split("\n\n");
fileMetadata.album = descItems[2];
fileMetadata.copyright = descItems[3];
if (descItems[4].startsWith("Released on:")) {
fileMetadata.date = descItems[4].replace("Released on: ", '').trim()
let descItems = basicInfo.short_description.split("\n\n", 5);
if (descItems.length === 5) {
fileMetadata.album = descItems[2];
fileMetadata.copyright = descItems[3];
if (descItems[4].startsWith("Released on:")) {
fileMetadata.date = descItems[4].replace("Released on: ", '').trim();
}
}
}