yt-dlp: [youtube] Stuck in infinite loop grabbing API JSON on channels

ytdl-errorapi.txt

Checklist

Region

North America or Worldwide

Description

I did my best to search the bug tracker but couldn’t find anything about this.

I am getting stuck in seemingly infinite loops where the youtube extractor tries to download the API JSON for channels. This bug does not appear to be channel specific, it simply triggers after either going through multiple other channels, or randomly with a single channel. I am unsure if it’s some kind of blackholing effect as a limiter.

Please see the verbose log for an example. The linked channel does not have over 1000 pages, let alone over 100.

This also occurs with other channels, it’s random. https://www.youtube.com/channel/UC5Jj_A0NjP2vtcZZvvYU7qw/videos or https://www.youtube.com/channel/UCnFP0IU4gpnmcLnVzDLUtfw

I’ve tried grabbing with different IPs over VPNs or powercycling my modem, with no change.

I can provide more details when needed. Thanks!

Verbose log

$ yt-dlp -Uv --config-location ./youtube-dl.conf
[debug] Command-line config: ['-vvv', '--config-location', './youtube-dl.conf']
[debug] Custom config file: ./youtube-dl.conf
[debug] Custom config: ['-f', 'bestvideo[ext=webm]+bestaudio[ext=webm]/bestvideo[ext=mp4]+bestaudio[ext=webm]/bestvide
o+bestaudio', '-i', '-o', '/mnt/youtubedl/%(uploader)s (%(uploader_id)s)/%(upload_date)s - %(title)s - [%(resolution)s] [%(id)s].%(ext)s', '--ffmpeg-location', '/usr/local/bin/', '--no-write-playlist-metafiles', '--concurrent-fragments', '16', '--downloader-args', '-x 16 -s 16', '--retries', '20', '--download-archive', '/mnt/youtubedl/youtube-dl-archive.txt', '-a', '/mnt/youtubedl/youtube-dl-channels.txt', '--merge-output-format', 'mkv', '--write-sub', '--all-subs', '--convert-subs', 'srt', '--add-metadata', '--write-description', '--write-thumbnail', '-v']
[debug] Batch file urls: ['https://www.youtube.com/channel/UCyduf4VRZnF7RXSrqqexX5w',]
WARNING: --downloader-args given without specifying name. The arguments will be given to all external downloaders
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, err UTF-8, pref UTF-8
[debug] yt-dlp version 2021.11.10.1 (zip)
[debug] Python version 3.7.3 (CPython 64bit) - Linux-5.10.0-0.bpo.8-amd64-x86_64-with-debian-10.11
[debug] exe versions: ffmpeg 4.2.1 (fdk), ffprobe 4.2.1
[debug] Optional libraries: Crypto, keyring, sqlite
[debug] Proxy map: {}
[debug] Loading archive file '/mnt/youtubedl/youtube-dl-archive.txt'
yt-dlp is up to date (2021.11.10.1)
[debug] [youtube:tab] Extracting URL: https://www.youtube.com/channel/UCyduf4VRZnF7RXSrqqexX5w
WARNING: [youtube:tab] A channel/user page was given. All the channel's videos will be downloaded. To download only th
e videos in the home page, add a "/featured" to the URL
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w: Downloading webpage
[debug] [youtube:tab] Final URL: https://www.youtube.com/channel/UCyduf4VRZnF7RXSrqqexX5w/videos
[download] Downloading playlist: Grace Motley - Videos
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 2: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 3: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 4: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 5: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 6: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 7: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 8: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 9: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 10: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 11: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 12: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 13: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 14: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 15: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 16: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 17: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 18: Downloading API JSON
[...]
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1638: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1639: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1640: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1641: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1642: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1643: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1644: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1645: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1646: Downloading API JSON
[youtube:tab] UCyduf4VRZnF7RXSrqqexX5w page 1647: Downloading API JSON
^C
ERROR: Interrupted by user

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Thanks for the insight, glad it isn’t just me. I will sit tight for a proper fix, and for urgent stuff will use your workaround!

Currently appears to be a YouTube issue, I’m getting this too, in yt-dlp and on the website itself. Passing the channel’s uploads playlist should workaround it for now.

Edit: sorting by oldest first is not impacted by this, so you can add ?view=0&sort=da&flow=grid to the /videos tab url as another temporary workaround if needed.

Edit2: Briefly looked at and compared continuations from newest sorting and oldest sorting. Though I am not entirely sure what’s going on, it does appear that YouTube has done a deploy to prod oopsie with their backend (again)? 😄 Hopefully they resolve this soon.

Edit3: TeamYouTube on Twitter are responding that YouTube is looking into the issue.

related: https://github.com/ytdl-org/youtube-dl/issues/30219, https://github.com/ytdl-org/youtube-dl/issues/30220

I’ve experienced this only very rarely on Topic playlist pages. --playlist-end works well to get past the infinite loop

https://m.youtube.com/channel/UCI4-cRRz7SKOg5LxAruPpbQ/playlists

It has not been fixed, it is just a lot more rare now, but it definitely still keeps happening.

An option to automatically derive and use the uploads playlist URL from the channels videos URL could be a useful addition to yt-dl to mitigate this problem in the future.

  1. This wont solve anything. Maybe next time, they will break playlists and not /videos 🤷
  2. The uploads playlist does not contain all videos of the channel for very large channels. So an auto-redirection is not good. It must be user’s own choice to choose one or the other