Skip to content

Commit bf7a48a

Browse files
committed
api/youtube: fix youtube music metadata parsing
still pretty crappy tho
1 parent 7d6fe34 commit bf7a48a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

api/src/processing/services/youtube.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,13 @@ export default async function(o) {
243243
}
244244

245245
if (basicInfo?.short_description?.startsWith("Provided to YouTube by")) {
246-
let descItems = basicInfo.short_description.split("\n\n");
247-
fileMetadata.album = descItems[2];
248-
fileMetadata.copyright = descItems[3];
249-
if (descItems[4].startsWith("Released on:")) {
250-
fileMetadata.date = descItems[4].replace("Released on: ", '').trim()
246+
let descItems = basicInfo.short_description.split("\n\n", 5);
247+
if (descItems.length === 5) {
248+
fileMetadata.album = descItems[2];
249+
fileMetadata.copyright = descItems[3];
250+
if (descItems[4].startsWith("Released on:")) {
251+
fileMetadata.date = descItems[4].replace("Released on: ", '').trim();
252+
}
251253
}
252254
}
253255

0 commit comments

Comments
 (0)