Skip to content

Commit

Permalink
api/youtube: fix youtube music metadata parsing
Browse files Browse the repository at this point in the history
still pretty crappy tho
  • Loading branch information
wukko committed Sep 27, 2024
1 parent 7d6fe34 commit bf7a48a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions api/src/processing/services/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down

0 comments on commit bf7a48a

Please sign in to comment.