trizen / youtube-viewer

Lightweight YouTube client for Linux
https://trizenx.blogspot.com/2012/03/gtk-youtube-viewer.html
Artistic License 2.0
1.18k stars 86 forks source link

Playlist pagination not working as expected #396

Open JohnnyVim opened 3 years ago

JohnnyVim commented 3 years ago

Hi, I am currently struggling with opening a playlist at a certain page of results.

$ youtube-viewer --page=4 "https://www.youtube.com/playlist?list=<*****>"
[400 Bad Request] Error occurred on URL: https://www.googleapis.com/youtube/v3/playlistItems?key=[...]&maxResults=20&pageToken=CLwAEAA&part=contentDetails,snippet&playlistId=<*****>&prettyPrint=false

[!] Inexistent playlist...

Opening the playlist without --page and entering :n 3 times still works. However, when open, directly jumping to a page via :page=4 or :end also fails:

> :page=4

:: Jumping to page 4
[400 Bad Request] Error occurred on URL: https://www.googleapis.com/youtube/v3/playlistItems?key=[...]&maxResults=20&part=contentDetails,snippet&playlistId=<*****>&prettyPrint=false&pageToken=CLwAEAA

[!] No video results!
> :end

:: Jumping to page 34
[400 Bad Request] Error occurred on URL: https://www.googleapis.com/youtube/v3/playlistItems?key=[...]&maxResults=20&part=contentDetails,snippet&playlistId=<*****>&prettyPrint=false&pageToken=CJQFEAA

[!] No video results!

As you can see from the output of the :end command, the playlist has 34 pages, so the page 4 I am trying to access is certainly in range. I tried other playlists as well, all leading to the same error. Additionally, I tried doing the same with pipe-viewer. This did not error but opened the results at page 1 when setting --page=4 which is obviously also not what I wanted.

Is this intended to work the way I am trying to use it? Is there anything else I should provide?

I am running Void (Linux). yv is up-to-date:

$ youtube-viewer --version
YouTube Viewer 3.9.4
trizen commented 3 years ago

Thanks for reporting the issue. I will have to look into this.

A quick workaround would be to save the playlist locally:

youtube-viewer --save-playlist <PLAYLIST_ID>

and then list the saved playlist with:

youtube-viewer -lp <PLAYLIST_ID>

which works OK with the options :beg, :end and :page=i.

ZaxonXP commented 3 years ago

The same happen when you use --page parameter > 1 with the -uv <channel_id>.

ZaxonXP commented 2 years ago

I see the --save-playlist is not working at the moment (#405). Here is how I found the workaround. I use Suckless simple terminal, which has the possibility to capture all what is visible on the terminal, so I opened it like this:

st -o playlist.txt

Then inside that terminal I open the youtube-viewer like this:

youtube-viewer --no-use-colors  --custom-layout='  *TIME* | *ID* | *PUBLISHED* | *TITLE*' -uv=UC_aEa8K-EOJ3D6gOs7HcyNg

then I pressed enter as long there was no more new records. Afterwards I closed the terminal and edited out the weeds. The list I use to play the videos using my supporting scripts.

Hope this helps in the time being. :)

Regards, Zaxon