Add code to prioritise human-made subtitles (#786)

This commit is contained in:
Dave Wickham authored and GitHub committed 2025-11-08 14:25:57 -05:00
1 parent d876f819fc
commit f1a3df81b2
1 file changed
+12 -2
@@ -316,6 +316,7 @@ namespace Innertube
end if end if
captions = [] captions = []
autoCaptions = []
for each track in tracks for each track in tracks
if not IsAssociativeArray(track) if not IsAssociativeArray(track)
continue for continue for
@@ -341,13 +342,22 @@ namespace Innertube
label = ParseText(track["name"]) label = ParseText(track["name"])
captions.Push({ thisCaption = {
"label": label "label": label
"language_code": languageCode "language_code": languageCode
"url": baseUrl "url": baseUrl
}) }
if track["kind"] = "asr"
autoCaptions.Push(thisCaption)
continue for
end if
captions.Push(thisCaption)
end for end for
' Put automatically generated captions at the end so human-generated ones take priority
captions.Append(autoCaptions)
return captions return captions
end function end function