Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement playlist pagination for the local API #2956

Merged

Conversation

absidue
Copy link
Member

@absidue absidue commented Dec 13, 2022

Implement playlist pagination for the local API

Pull Request Type

  • Feature Implementation

Description

This pull request implement pagination on the playlist page when the local API is selected. I also got rid of the unused methods and variables that were copied from the search page.

I didn't implement pagination for Invidious in this PR, as their pagination system is confusing, weird and will likely require talking to the Invidious devs to understand it or ask them to fix their system (see the discussion on Matrix for more details).

Testing

playlist with 100 videos, only a single page (check that load more button is hidden)
https://www.youtube.com/playlist?list=PL4fGSI1pDJn6puJdseH2Rt9sMvt9E2M4i

playlist with 872 videos, multiple pages
https://www.youtube.com/playlist?list=PLbMjU_TVMIFvmkQ871iUvE5gy5ezXc6hE

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 0.18.0

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 13, 2022 16:39
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 13, 2022
@ChunkyProgrammer
Copy link
Member

For invidious, it does give you a videoCount so we could look at that to see if there's any more pages

@absidue
Copy link
Member Author

absidue commented Dec 13, 2022

I haven't looked at Invidious' code but they are probably just sending the estimate that YouTube has on their page, I say estimate because that number also counts the videos that can't be played (privated, copyright striked or deleted) and are not shown in the playlist. So that number might be the same as the total number of videos but it lots of playlists, especially big ones, that number will always be larger than the total number of videos.

ytpl and ytch both check for continuation data, Invidious doesn't seem to have that mechanism, or at least not exposed through the API

@absidue
Copy link
Member Author

absidue commented Dec 13, 2022

eg.
with the 100 video playlist from above that only has a single page

with page=1 (the same as not specify the page parameter) you get all 100 videos
https://inv.riverside.rocks/api/v1/playlists/PL4fGSI1pDJn6puJdseH2Rt9sMvt9E2M4i?page=1

with page=2, you get the last 50 videos in the playlist, despite the playlist only having one page
https://inv.riverside.rocks/api/v1/playlists/PL4fGSI1pDJn6puJdseH2Rt9sMvt9E2M4i?page=2

with page=3, you finally get an empty array of videos
https://inv.riverside.rocks/api/v1/playlists/PL4fGSI1pDJn6puJdseH2Rt9sMvt9E2M4i?page=3

@ChunkyProgrammer
Copy link
Member

We should definitely open an issue on the invidious repo then

Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with

playlist with 100 videos, only a single page (check that load more button is hidden)
https://www.youtube.com/playlist?list=PL4fGSI1pDJn6puJdseH2Rt9sMvt9E2M4i

playlist with 872 videos, multiple pages
https://www.youtube.com/playlist?list=PLbMjU_TVMIFvmkQ871iUvE5gy5ezXc6hE

@FreeTubeBot FreeTubeBot merged commit 5b04352 into FreeTubeApp:development Dec 14, 2022
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 14, 2022
@ChunkyProgrammer
Copy link
Member

It appears to be a known invidious issue iv-org/invidious#2694

@absidue absidue deleted the local-playlist-pagination branch December 14, 2022 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants