fix(channel): fix shorts/streams pagination using continuation tokens

- Add continuation_token_cache to store ctokens between page requests
- Use cached ctoken for page 2+ instead of generating fresh tokens
- Switch shorts/streams to Next/Previous buttons (no page numbers)
- Show "N+ videos" indicator when more pages are available
- Fix UnboundLocalError when page_call was undefined for shorts/streams

The issue was that YouTube's InnerTube API requires continuation tokens
for pagination on shorts/streams tabs, but the code was generating a new
ctoken each time, always returning the same 30 videos.
This commit is contained in:
2026-04-05 18:19:05 -05:00
parent 8403e30b3a
commit e8e2aa93d6
2 changed files with 59 additions and 16 deletions

View File

@@ -82,7 +82,11 @@
<div id="links-metadata">
{% if current_tab in ('videos', 'shorts', 'streams') %}
{% set sorts = [('3', 'newest'), ('4', 'newest - no shorts')] %}
<div id="number-of-results">{{ number_of_videos }} videos</div>
{% if current_tab in ('shorts', 'streams') and not is_last_page %}
<div id="number-of-results">{{ number_of_videos }}+ videos</div>
{% else %}
<div id="number-of-results">{{ number_of_videos }} videos</div>
{% endif %}
{% elif current_tab == 'playlists' %}
{% set sorts = [('3', 'newest'), ('4', 'last video added')] %}
{% if items %}
@@ -117,7 +121,11 @@
<hr/>
<footer class="pagination-container">
{% if current_tab in ('videos', 'shorts', 'streams') %}
{% if current_tab in ('shorts', 'streams') %}
<nav class="next-previous-button-row">
{{ common_elements.next_previous_buttons(is_last_page, channel_url + '/' + current_tab, parameters_dictionary) }}
</nav>
{% elif current_tab == 'videos' %}
<nav class="pagination-list">
{{ common_elements.page_buttons(number_of_pages, channel_url + '/' + current_tab, parameters_dictionary, include_ends=(current_sort.__str__() in '34')) }}
</nav>