Potentially a more reliable way to get streams
This commit is contained in:
1 parent
464d436fa8
commit
45c618ccda
2 files changed
+17
-2
No files matched your search
@@ -23,7 +23,18 @@ end sub
|
|||||||
function GetVideoMetadata()
|
function GetVideoMetadata()
|
||||||
videoId = m.top.getField("videoid")
|
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
|
end function
|
||||||
|
|
||||||
function GetVideoSponsorBlock()
|
function GetVideoSponsorBlock()
|
||||||
|
|||||||
@@ -39,7 +39,11 @@ namespace RokuYoutube.Services.Invidious
|
|||||||
end if
|
end if
|
||||||
end function
|
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}`
|
url = `${API_URL}${VIDEOS_ENDPOINT}/${videoId}`
|
||||||
response = Requests().get(url)
|
response = Requests().get(url)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user