From b6f2324a91983cebd3c277fd3880d3165e38608e Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:42:38 +1100 Subject: [PATCH] Add support for sequentially filling Trending listing --- .../youtube/helper/yt_specials.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_specials.py b/resources/lib/youtube_plugin/youtube/helper/yt_specials.py index 01e01ab0a..0a044eb8a 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_specials.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_specials.py @@ -118,12 +118,24 @@ def _process_trending(provider, context, client): context.set_content(CONTENT.VIDEO_CONTENT) json_data = client.get_trending_videos( - page_token=context.get_param('page_token', '') + page_token=context.get_param('page_token') ) - if not json_data: - return False - return v3.response_to_items(provider, context, json_data) + if json_data: + def filler(json_data, _remaining): + page_token = json_data.get('nextPageToken') + if not page_token: + return None + + json_data = client.get_trending_videos( + page_token=page_token, + ) + json_data['_filler'] = filler + return json_data + + json_data['_filler'] = filler + return v3.response_to_items(provider, context, json_data) + return False def _process_browse_channels(provider, context, client):