diff --git a/YoutubeConfig.json b/YoutubeConfig.json index 1c852345e5d6d96653380b673f93529c02146cdb..96c7199bae592c763803ba4ddc2da73dcbe691e0 100644 --- a/YoutubeConfig.json +++ b/YoutubeConfig.json @@ -7,7 +7,7 @@ "sourceUrl": "https://plugins.grayjay.app/Youtube/YoutubeConfig.json", "repositoryUrl": "https://futo.org", "scriptUrl": "./YoutubeScript.js", - "version": 180, + "version": 181, "iconUrl": "./youtube.png", "id": "35ae969a-a7db-11ed-afa1-0242ac120002", diff --git a/YoutubeScript.js b/YoutubeScript.js index 5836ab0cc8770310a11a1e1b655c2d7df173cf5f..2233cf20bb1d383b026d5f8bdabf610ab23845b8 100644 --- a/YoutubeScript.js +++ b/YoutubeScript.js @@ -1206,31 +1206,33 @@ source.getPlaylist = function (url) { }); } - //TODO: Make a proper pager - /* - while (continuationToken) { - const newData = validateContinuation(()=>requestBrowse({ - continuation: continuationToken - }, USE_MOBILE_PAGES, true)); - - if (newData.length < 1) { - break; - } + //Fallback for old apps + if(!bridge.buildVersion || bridge.buildVersion < 244) { + log("Using legacy remote playlist (all videos first page)"); + while (continuationToken) { + const newData = validateContinuation(()=>requestBrowse({ + continuation: continuationToken + }, USE_MOBILE_PAGES, true)); + + if (newData.length < 1) { + break; + } - continuationToken = null; - for(let playlistRenderer of newData) { - switchKey(playlistRenderer, { - playlistVideoRenderer(renderer) { - const video = extractPlaylistVideoRenderer_Video(renderer); - if(video) - videos.push(video); - }, - continuationItemRenderer(continueRenderer) { - continuationToken = continueRenderer?.continuationEndpoint?.continuationCommand?.token; - } - }); + continuationToken = null; + for(let playlistRenderer of newData) { + switchKey(playlistRenderer, { + playlistVideoRenderer(renderer) { + const video = extractPlaylistVideoRenderer_Video(renderer); + if(video) + videos.push(video); + }, + continuationItemRenderer(continueRenderer) { + continuationToken = continueRenderer?.continuationEndpoint?.continuationCommand?.token; + } + }); + } } - }*/ + } let thumbnail = null; if(videos && videos.length > 0 &&