Feat: Implement pagination for playlists when using Invidious API - #9564
Feat: Implement pagination for playlists when using Invidious API#9564Shadorc wants to merge 1 commit into
Conversation
|
Can't find a working instance to test |
absidue
left a comment
There was a problem hiding this comment.
Just like PikachuEXE and all other FreeTube maintainers, I have no way to test this pull request, as there are no public Invidious instances that have the API enabled (going through all the effort to set up an Invidious server on a Windows machine just to test this one pull request is not worth it).
You are also missing a few test cases:
- Navigating to the watch page after loading all videos on the playlist page should carry over all videos.
- Open the playlist page and without loading anymore videos on the playlist page, navigate to the watch page, the watch page should carry over the already loaded videos and load the remaining playlist videos.
- Navigate directly to the watch page with a playlist (
/watchURL with the&list=query parameter), the watch page should retrieve the entire playlist.
However, I had to compensate for the lookback window which is not useful in our case (I don't know in which scenario it could be useful too...).
It is useful if you want to show some videos before and after the current video on the watch page (that is probably also why there is an undocumented index parameter in the Invidious API). FreeTube loads the entire playlist on the watch page. The look back window combined with Invidious trying to return 2 YouTube pages (100 videos) worth of videos for every Invidious page (200 videos), are what are causing the problems.
|
Indeed, when I opened this MR, I was worried that it could be hard to test, given that no public Invidious instances have their API enabled. Thanks for the additional test cases! Edit: Test cases updated |
|
My computer is set up for Invidious development, I can probably test this in ~12 hours |
|
[x] Large playlist can be fully loaded Seemed to work well with your example playlist. I tested with Invidious api + fallback api set to off.
|
efb4f5ff-1298-471a-8973-3d47447115dc
left a comment
There was a problem hiding this comment.
All cases and more stuff i could think of passed testing. Tested on Pika's private instance
|
Has anyone tested with a playlist containing a large number of videos that are unavailable? Update 1: I have the same behaviour on development so it's not related to this MR |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |


Pull Request Type
Related issue
closes #2333
This is considered to be a bug, but the fix needs implementing a feature.
Description
Add support for Invidious playlists pagination.
Also, fix the video count in the playlist description to display the total count.
There are three ways to implement pagination with Invidious API, two of them are undocumented:
page: Inconsistent behaviour (see [Bug] Playlists API endpoint 'page' param is inconsistent iv-org/invidious#5816) which makes it hard to rely on for cachingindex: More consistent thanpage, it is the video index in the playlist. A lookback window of 50 is applied to the valuecontinuation: Same asindexbut with avideo_id. It is commented as being expensive.I chose
index, which is the less expensive and the more consistent. However, I had to compensate for the lookback window which is not useful in our case (I don't know in which scenario it could be useful too...).Testing
All tests require
Settings > General > Preferred API Backendto be set toInvidious APIwith an Invidious instance having its API enabled.Large playlist can be fully loaded
Load More Videosbutton appearsPlaylist cache is conserved when navigating to watch page
This one requires some feedback from the code. I would suggest adding a log to the
invidious#invidiousGetPlaylistInfofunction.invidiousGetPlaylistInfois not calledWatch page loads the full playlist
Direct acces to watch page loads the full playlist
Regression
Check that the behaviour hasn't changed for:
Desktop