Fix proxying in dash manifest (#607)
* Fix proxying in dash manifest * Changelog
This commit is contained in:
1 parent
7c1aa80819
commit
8d42c0213b
3 files changed
+29
-2
No files matched your search
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- A few issues related to Playlet backend feeds and caching
|
- A few issues related to Playlet backend feeds and caching
|
||||||
- An error when Invidious doesn't return valid video metadata
|
- An error when Invidious doesn't return valid video metadata
|
||||||
- A bug where playlists with small number of videos has duplicates
|
- A bug where playlists with small number of videos has duplicates
|
||||||
|
- A bug where DASH manifest was not generated correctly for proxied Invidious videos
|
||||||
|
|
||||||
## [0.37.0] - 2025-05-16
|
## [0.37.0] - 2025-05-16
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class DashManifest
|
|||||||
m.invidiousInstance = invidiousInstance
|
m.invidiousInstance = invidiousInstance
|
||||||
|
|
||||||
m.utils = new Http.Utils()
|
m.utils = new Http.Utils()
|
||||||
m.urlRegex = /https?:\/\/\S+(\/\S+)/i
|
|
||||||
|
|
||||||
' https://github.com/LuanRT/YouTube.js/blob/6082b4a52ee07a622735e6e9128a0531a5ae3bfb/src/utils/StreamingInfo.ts#L332-L349
|
' https://github.com/LuanRT/YouTube.js/blob/6082b4a52ee07a622735e6e9128a0531a5ae3bfb/src/utils/StreamingInfo.ts#L332-L349
|
||||||
m.colorInfo = {
|
m.colorInfo = {
|
||||||
@@ -38,8 +37,11 @@ class DashManifest
|
|||||||
adaptiveFormats.Append(metadata.adaptiveFormats)
|
adaptiveFormats.Append(metadata.adaptiveFormats)
|
||||||
|
|
||||||
if local
|
if local
|
||||||
|
parsedInvidiousUrl = UrlUtils.ParseUrl(m.invidiousInstance)
|
||||||
for i = 0 to adaptiveFormats.Count() - 1
|
for i = 0 to adaptiveFormats.Count() - 1
|
||||||
adaptiveFormats[i].url = m.urlRegex.replace(adaptiveFormats[i].url, m.invidiousInstance + "\1")
|
parsedUrl = UrlUtils.ParseUrl(adaptiveFormats[i].url)
|
||||||
|
parsedInvidiousUrl.path = UrlUtils.AppendQueryParams(parsedUrl.path, { host: parsedUrl.host })
|
||||||
|
adaptiveFormats[i].url = UrlUtils.BuildUrlFromParts(parsedInvidiousUrl)
|
||||||
end for
|
end for
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|||||||
@@ -246,4 +246,28 @@ namespace UrlUtils
|
|||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function BuildUrlFromParts(parts as object) as string
|
||||||
|
url = ""
|
||||||
|
if not StringUtils.IsNullOrEmpty(parts.protocol)
|
||||||
|
url += parts.protocol + "://"
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not StringUtils.IsNullOrEmpty(parts.host)
|
||||||
|
url += parts.host
|
||||||
|
end if
|
||||||
|
|
||||||
|
if (not StringUtils.IsNullOrEmpty(parts.port)) and ((parts.protocol = "http" and parts.port <> "80") or (parts.protocol = "https" and parts.port <> "443") or (parts.protocol <> "http" and parts.protocol <> "https"))
|
||||||
|
url += ":" + parts.port
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not StringUtils.IsNullOrEmpty(parts.path)
|
||||||
|
if not parts.path.StartsWith("/")
|
||||||
|
url += "/"
|
||||||
|
end if
|
||||||
|
url += parts.path
|
||||||
|
end if
|
||||||
|
|
||||||
|
return url
|
||||||
|
end function
|
||||||
|
|
||||||
end namespace
|
end namespace
|
||||||
Reference in new issue
Block a user