Videos: Append '&mpd_version=5' to DASH manifest URL (#4196)

This commit is contained in:
Samantaz Fox 2023-12-06 18:20:26 +01:00
commit e8a14446af
No known key found for this signature in database
GPG Key ID: F42821059186176E
1 changed files with 16 additions and 2 deletions

View File

@ -227,8 +227,22 @@ struct Video
info.dig?("streamingData", "hlsManifestUrl").try &.as_s info.dig?("streamingData", "hlsManifestUrl").try &.as_s
end end
def dash_manifest_url def dash_manifest_url : String?
info.dig?("streamingData", "dashManifestUrl").try &.as_s raw_dash_url = info.dig?("streamingData", "dashManifestUrl").try &.as_s
return nil if raw_dash_url.nil?
# Use manifest v5 parameter to reduce file size
# See https://github.com/iv-org/invidious/issues/4186
dash_url = URI.parse(raw_dash_url)
dash_query = dash_url.query || ""
if dash_query.empty?
dash_url.path = "#{dash_url.path}/mpd_version/5"
else
dash_url.query = "#{dash_query}&mpd_version=5"
end
return dash_url.to_s
end end
def genre_url : String? def genre_url : String?