Refactor format stream url

This commit is contained in:
Brahim Hadriche committed 2023-05-01 17:19:57 -04:00
1 parent 5c43bdf904
commit b7e6a1ea83
3 files changed
+14 -12

No files matched your search

@@ -136,11 +136,8 @@ function OnVideoDetailsTaskResults(output as object) as void
end if
if metadata.formatStreams.Count() > 0
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
itag = stream.itag
playletStreamUrls.push(Invidious.GetVideoUrl(videoId, itag, false))
playletStreamUrls.push(Invidious.GetVideoUrl(videoId, itag, true))
playletStreamUrls.push(Invidious.GetVideoStreamUrl(videoId, false))
playletStreamUrls.push(Invidious.GetVideoStreamUrl(videoId, true))
end if
end if
@@ -19,17 +19,13 @@ namespace Http
instance = InvidiousSettings.GetSelectedInstance()
metadata = router.GetVideoMetadata(context, v)
dashUrl = `${instance}/api/manifest/dash/id/${v}`
dashUrl = Invidious.GetVideoDashUrl(v, local <> invalid)
if metadata = invalid and local = invalid
response.Redirect(dashUrl)
return true
end if
if local <> invalid
dashUrl = `${dashUrl}?local=${local}`
end if
resp = Requests().get(dashUrl, { parseJson: false })
text = resp.text ?? ""
if resp.statuscode = 200 and local = "true"