Potentially a more reliable way to get streams

This commit is contained in:
Brahim Hadriche committed 2022-11-05 15:49:48 -04:00
1 parent 464d436fa8
commit 45c618ccda
2 files changed
+17 -2

No files matched your search

@@ -23,7 +23,18 @@ end sub
function GetVideoMetadata()
videoId = m.top.getField("videoid")
return RokuYoutube.Services.Invidious.GetVideoMetadataForVideo(videoId)
videoMetadata = RokuYoutube.Services.Invidious.GetVideoMetadata(videoId)
lastItag = videoMetadata.formatStreams[videoMetadata.formatStreams.Count() - 1].itag
' GetVideoUrl returns a url with the local=true, leading to less change of rate limit (403) - maybe?
' TODO: is this reliable?
videoUrl = RokuYoutube.Services.Invidious.GetVideoUrl(videoId, lastItag)
videoMetadata.formatStreams.push({
itag: lastItag,
url: videoUrl
})
return videoMetadata
end function
function GetVideoSponsorBlock()
+5 -1
View File
@@ -39,7 +39,11 @@ namespace RokuYoutube.Services.Invidious
end if
end function
function GetVideoMetadataForVideo(videoId as string)
function GetVideoUrl(videoId as string, itag as string)
return `${API_URL}/latest_version?id=${videoId}&itag=${itag}&local=true`
end function
function GetVideoMetadata(videoId as string)
url = `${API_URL}${VIDEOS_ENDPOINT}/${videoId}`
response = Requests().get(url)