Use ttml for captions
This commit is contained in:
1 parent
a1c9ae8884
commit
72a55b5414
3 files changed
+11
-18
No files matched your search
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- A bug when invalidating tokens
|
- A bug when invalidating tokens
|
||||||
|
- Issue with auto-generated subtitles aligned to the left by using TTML captions
|
||||||
|
|
||||||
## [0.42.1] - 2025-10-04
|
## [0.42.1] - 2025-10-04
|
||||||
|
|
||||||
|
|||||||
@@ -1631,13 +1631,13 @@ namespace Innertube
|
|||||||
return nodeData["content"]
|
return nodeData["content"]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParseText(data as object) as string
|
function ParseText(data as dynamic) as string
|
||||||
if data = invalid
|
|
||||||
return ""
|
|
||||||
end if
|
|
||||||
if IsString(data)
|
if IsString(data)
|
||||||
return data
|
return data
|
||||||
end if
|
end if
|
||||||
|
if not IsAssociativeArray(data)
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
if data.DoesExist("simpleText")
|
if data.DoesExist("simpleText")
|
||||||
return data["simpleText"]
|
return data["simpleText"]
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -291,7 +291,11 @@ namespace Innertube
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
queryComponents = UrlUtils.ParseQueryComponents(baseUrl)
|
queryComponents = UrlUtils.ParseQueryComponents(baseUrl)
|
||||||
queryComponents["fmt"] = "vtt"
|
' Can be vtt, ttml or srt
|
||||||
|
' vtt has "align:start position:0%" on auto-generated captions
|
||||||
|
' srt has large spacing between lines on auto-generated captions
|
||||||
|
' ttml has default styling, with smaller font than the default size
|
||||||
|
queryComponents["fmt"] = "ttml"
|
||||||
baseUrl = UrlUtils.SetQueryParams(baseUrl, queryComponents)
|
baseUrl = UrlUtils.SetQueryParams(baseUrl, queryComponents)
|
||||||
|
|
||||||
languageCode = track["languageCode"]
|
languageCode = track["languageCode"]
|
||||||
@@ -299,19 +303,7 @@ namespace Innertube
|
|||||||
continue for
|
continue for
|
||||||
end if
|
end if
|
||||||
|
|
||||||
label = ""
|
label = ParseText(track["name"])
|
||||||
name = track["name"]
|
|
||||||
if IsAssociativeArray(name)
|
|
||||||
runs = name["runs"]
|
|
||||||
if IsArray(runs)
|
|
||||||
for each rn in runs
|
|
||||||
text = rn["text"]
|
|
||||||
if IsString(text)
|
|
||||||
label += text
|
|
||||||
end if
|
|
||||||
end for
|
|
||||||
end if
|
|
||||||
end if
|
|
||||||
|
|
||||||
captions.Push({
|
captions.Push({
|
||||||
"label": label
|
"label": label
|
||||||
|
|||||||
Reference in new issue
Block a user