From 38f03a838c72463f556d0f3d0b754a4b8edc69de Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 7 Nov 2022 15:38:38 -0500 Subject: [PATCH] Move hacky link to Invidious --- src/components/tasks/VideoDetailsLoaderTask.brs | 14 +------------- src/source/services/Invidious.bs | 12 +++++++++++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/components/tasks/VideoDetailsLoaderTask.brs b/src/components/tasks/VideoDetailsLoaderTask.brs index f3e9b84f..ac6e818c 100644 --- a/src/components/tasks/VideoDetailsLoaderTask.brs +++ b/src/components/tasks/VideoDetailsLoaderTask.brs @@ -23,19 +23,7 @@ end sub function GetVideoMetadata() videoId = m.top.getField("videoid") - videoMetadata = RokuYoutube.Services.Invidious.GetVideoMetadata(videoId) - lastItag = videoMetadata.formatStreams[videoMetadata.formatStreams.Count() - 1].itag - - ' GetVideoUrl returns a url that redirects to the video stream - ' TODO: is this reliable? - videoUrl = RokuYoutube.Services.Invidious.GetVideoUrl(videoId, lastItag, false) - - videoMetadata.formatStreams.push({ - itag: lastItag, - url: videoUrl - }) - - return videoMetadata + return RokuYoutube.Services.Invidious.GetVideoMetadata(videoId) end function function GetVideoSponsorBlock() diff --git a/src/source/services/Invidious.bs b/src/source/services/Invidious.bs index 8e93285d..e00b4fa5 100644 --- a/src/source/services/Invidious.bs +++ b/src/source/services/Invidious.bs @@ -73,7 +73,17 @@ namespace RokuYoutube.Services.Invidious ' TODO: handle 500 {"error":"This video is unavailable"} if response.statuscode = 200 - return response.json + videoMetadata = response.json + lastItag = videoMetadata.formatStreams[videoMetadata.formatStreams.Count() - 1].itag + + ' GetVideoUrl returns a url that redirects to the video stream + ' TODO: is this reliable? + videoUrl = RokuYoutube.Services.Invidious.GetVideoUrl(videoId, lastItag, false) + + videoMetadata.formatStreams.push({ + itag: lastItag, + url: videoUrl + }) end if end function