yt-dlp: [Youtube] Immediate HTTP Error 403 on download
đ¨ click here to see the current status of this issue đ¨
- I understand that I will be blocked if I intentionally remove or skip any mandatory* field
Checklist
- Iâm reporting that yt-dlp is broken on a supported site
- Iâve verified that I have updated yt-dlp to nightly or master (update instructions)
- Iâve checked that all provided URLs are playable in a browser with the same IP and same login details
- Iâve checked that all URLs and arguments with special characters are properly quoted or escaped
- Iâve searched known issues and the bugtracker for similar issues including closed ones. DO NOT post duplicates
- Iâve read the guidelines for opening an issue
- Iâve read about sharing account credentials and Iâm willing to share it if required
Region
Germany
Provide a description that is worded well enough to be understood
Downloading videos currently results in an 403 error. What I found out is, that the video gets played in browser when being logged in, when trying to start the videos in a private window without cookies, the video doesnât start without an error. However, the ads do play.
Provide verbose output that clearly demonstrates the problem
- Run your yt-dlp command with -vU flag added (
yt-dlp -vU <your command line>) - If using API, add
'verbose': TruetoYoutubeDLparams instead - Copy the WHOLE output (starting with
[debug] Command-line config) and insert it below
Complete Verbose Output
yt-dlp -vU https://www.youtube.com/watch?v=l35ok-7n2IU
[debug] Command-line config: ['-vU', 'https://www.youtube.com/watch?v=l35ok-7n2IU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.12.15.232913 from yt-dlp/yt-dlp-nightly-builds [d298693b1] (win_exe)
[debug] Python 3.10.11 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1t 7 Feb 2023)
[debug] exe versions: ffmpeg 2024-05-13-git-37db0454e4-essentials_build-www.gyan.dev (setts), ffprobe 2024-05-13-git-37db0454e4-essentials_build-www.gyan.dev, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.12.14, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.32.3, sqlite3-3.40.1, urllib3-2.2.3, websockets-14.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1837 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.12.15.232913 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.12.15.232913 from yt-dlp/yt-dlp-nightly-builds)
[youtube] Extracting URL: https://www.youtube.com/watch?v=l35ok-7n2IU
[youtube] l35ok-7n2IU: Downloading webpage
[youtube] l35ok-7n2IU: Downloading ios player API JSON
[youtube] l35ok-7n2IU: Downloading mweb player API JSON
[debug] [youtube] Extracting signature function js_03dbdfab_107
[debug] Loading youtube-sigfuncs.js_03dbdfab_107 from cache
[debug] Loading youtube-nsig.03dbdfab from cache
[debug] [youtube] Decrypted nsig aV2SlxDn5CNaYgrXF => IlSumDx_jM-HcQ
[debug] Loading youtube-nsig.03dbdfab from cache
[debug] [youtube] Decrypted nsig DD96eHcKsL6Qq9E90 => hxviA3B9kS_9QA
[debug] [youtube] Extracting signature function js_03dbdfab_103
[debug] Loading youtube-sigfuncs.js_03dbdfab_103 from cache
[youtube] l35ok-7n2IU: Downloading m3u8 information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec, channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] l35ok-7n2IU: Downloading 1 format(s): 313+251
[debug] Invoking http downloader on "https://rr3---sn-8vq54voxqx-cxgs.googlevideo.com/videoplayback?expire=1734837482&ei=ijBnZ5bkLN7t6dsPxZnjqA8&ip=2a02%3A8109%3A9d8f%3A3e00%3A693d%3A9ea1%3A7054%3A8015&id=o-AD-6zsiRz7FIC1te5s18LyYs5Y8ksIOFcZIi9DwV-4eZ&itag=313&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&met=1734815882%2C&mh=OR&mm=31%2C29&mn=sn-8vq54voxqx-cxgs%2Csn-i5h7lnll&ms=au%2Crdu&mv=m&mvi=3&pl=43&rms=au%2Cau&initcwndbps=3333750&bui=AfMhrI_ngaE8pa7Haos9jOTZ3q5auYyyVfDQXr5jsroWyEFRCr9GmkX8qUqEH8wbn8V2hlhS9c3-WuEV&spc=x-caUMh6H49vmv_2Nq1W3Z-hU6SkreEU_haD9Rl720YYO1YqHc5O&vprv=1&svpuc=1&mime=video%2Fwebm&rqh=1&gir=yes&clen=6804056254&dur=3879.720&lmt=1734697485233688&mt=1734815349&fvip=3&keepalive=yes&fexp=51326932%2C51335594%2C51371294&c=IOS&txp=4432434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRgIhAPI4tNsuKx7xFM9mNgrxyyp8hSGN0-5CbzTuHZVdC9jXAiEA8wF4h9cuQjRMIDaEFCRCiwLDkWelVq5pslq_8uHVYPg%3D&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms%2Cinitcwndbps&lsig=AGluJ3MwRgIhAJJ-X3tKgTINiH5L18EpIN5fb92EiSjLW5srWP1fl6CmAiEAncDu51bsexappSLmrSkwFZ4ZUfKzdhk4uOfkHq8jU8Q%3D"
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
File "yt_dlp\YoutubeDL.py", line 3461, in process_info
File "yt_dlp\YoutubeDL.py", line 3199, in dl
File "yt_dlp\downloader\common.py", line 464, in download
File "yt_dlp\downloader\http.py", line 367, in real_download
File "yt_dlp\downloader\http.py", line 118, in establish_connection
File "yt_dlp\YoutubeDL.py", line 4162, in urlopen
File "yt_dlp\networking\common.py", line 117, in send
File "yt_dlp\networking\_helper.py", line 208, in wrapper
File "yt_dlp\networking\common.py", line 340, in send
File "yt_dlp\networking\_requests.py", line 365, in _send
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 28
- Comments: 87 (19 by maintainers)
Links to this issue
Commits related to this issue
- [ie/youtube] Skip iOS formats that require PO Token (#11890) Partial fix for https://github.com/yt-dlp/yt-dlp/issues/11868 Authored by: coletdjnz — committed to djsaikrishna/yt-dlp by coletdjnz 2 years ago
A workaround I found is to force IPv4, I decided to try after it worked on my laptop and not my desktop. They are either having issues or intentionally banning v6 addresses that are downloading a lot.
Basically, just pass the -4 flag and if it still doesnât work try the -6 flag. If neither work, then you may be SoL in terms of youtube.
An update from some preliminary investigation - there are two issues we appear to be seeing here:
A rollout or A/B test of what we presume is a PO Token requirement on the iOS client. This will produce an HTTP 403 error on iOS videoplayback urls, either immediately or midway through streaming if a valid iOS PO Token is not provided.
-S proto:hls) or use another client (--extractor-args "youtube:player-client=default,-ios"). Both should work.YouTube is experimenting with some sort of new aggressive IP-based block on videoplayback urls - perhaps to replace or complement the existing âsign in to confirm you are not a botâ error on the player endpoint. This produces an HTTP 403 error on videoplayback urls, regardless of client and protocol (HTTPS, DASH, HLS, UMP, SABR, ONESIE).
With the changes YouTube has been pushing recently, it is likely the out-of-the-box YouTube format support for yt-dlp will become more limited. To retain format support, we recommend looking into using/adding the WEB client with a PO Token. You can do this manually or automatically via plugins. Refer to the PO Token Guide for more information.
Whenever i download a video from Y2Mate this stupid âAccess deniedâ error keeps popping up!
Adding --extractor-args âyoutube:po_token=web+XXXâ fixed it for me. I have also passed the user agent, switched to ipv4 and downloaded a nightly build, but this is the only thing that worked
Refreshing my public IP to another worked for me, looks like YT are detecting the download and banning via IP.
Not sure how much it helps, but NewPipe have a fix for this - they implement YTâs poToken generator in a mini Javascript VM thatâs able to pass YTâs integrity checks: https://github.com/TeamNewPipe/NewPipe/pull/11955
I can confirm that downloading works in the NewPipe client.
@richardstevenhack
BTW, thanks for your suggested workaround above. I just got it working now.
Here are the full steps, formatted slightly, to make it easier for others to copy-paste and get going, if they are using the Terminal.app on macOS.
Cookie Workaround for HTTP 403 Error
Before you begin, open System Preferences > Security & Privacy then grant âFull Disk Accessâ to Terminal.app[^1].
If you havenât granted Terminal.app this permission, you will get the following error when executing the command in step 2:
The next command will extract ALL your browser cookies into the file
cookies.txt.Note that the argument
-venables verbose output while the argument-Uupdates your version ofyt-dlpto the latest.Now proceed with downloading your videos as before, but remember to include the
cookies.txtcreated in step 2:[^1]: The fix is from this comment https://github.com/yt-dlp/yt-dlp/issues/7392#issuecomment-1657496651 or you can refer to the screenshot in this SO answer, if the explanation is unclear.
@coletdjnz ⌠saw you removed âhigh priorityâ (which I would disagree with đ and just to be clear; The issue persists and has not been resolved. I canât use the tool without risking to have my IP banned again, unless I login and used an account ⌠which, in my use-case, completely defeats the purpose of using the tool in the first place⌠(privacy).
Hope this issue isnât forgotten as a result âŚ
The cookies option is to log in to your Youtube account, then execute yt-dlp with this option:
yt-dlp --cookies-from-browser [browser: chrome or firefox or whatever] --cookies cookies.txt. yt-dlp will extract the browser cookies and save them to the filepath specified after --cookies.
Then you pass the cookies from the cookies.txt file to yt-dlp with your download request using this option:
âcookies /path/to/cookies/file.txt
Iâm not sure if you have to be logged in to the account while passing the cookies.txt file. I havenât tried that.
I applied the TLSv1_3 fix, same 403 error
Since today, youtube is blocking video viewing without ads. It impacts yt-dlp but also firefox + ublock origin. Everything works fine on chrome.
I started seeing this yesterday, so quite some time after this was first seen. My findings:
403 Forbiddenyesterday.videoplaybackcall that fails.(failed)net::ERR_INCOMPLETE_CHUNKED_ENCODINGor(failed)net::ERR_EMPTY_RESPONSENS_ERROR_NET_INTERRUPT,CORS Failed, orNS_ERROR_PARTIAL_TRANSFERyt-dlp-4or-6makes no difference.What works:
yt-dlp, privacy.Good morning everyone! Just want to add my findings, maybe it helps:
The only difference, seen from outside my network, is that I visited YouTube on my workstation before starting the yt-dlp download (of course, to gather the links). Firefox with logged in account. And the vm is on another IPv6 subnet (VLAN).
I wish you all merry christmas and some relaxing days, even without YouTube! đ
I also faced HTTP error 403 too while using ytdlp-interface which relies on yt-dlp. yt-dlp version is latest. Not just yt-dlp, 3rd-party YouTube downloaders (Tried Wonderfox & Winxvideo) also affected. Changing DNS makes YouTube downloader working again (I use Cloudflare DNS).
@InfinityLoop1308 I was trying to see if reports of the
iosPO token requirement were getting mixed in with the overall googleplayback IP block that seems to be going on in the most of the reports@InfinityLoop1308 as stated in an earlier comment, this issue looks like it is two separate issues being reported in the same thread. I am not suggesting that using
mwebis a viable workaround for everybody. I am trying to figure out what is going on.@bashonly it works if I remove the cookies from my config, yes. Also I just ran âupdate-to nightlyâ so it should be the latest possible version
@bashonly I can successfully download with that
mwebargument instead of the PO token, with 2024.12.13.@Husenberg @vphantom could each of you test if
--extractor-arg "youtube:player_client=mweb"works (without any PO token or cookies)? Also please make sure you are on yt-dlp version 2024.12.13 or laterItâs possible that we are seeing multiple issues with the same error being reported in this thread, and this will help diagnose exactly what is happening.
I can confirm: I made a PO token with instructions in https://github.com/yt-dlp/yt-dlp/wiki/Extractors#manually-acquiring-a-po-token-from-a-browser-for-use-when-logged-out without the
--cookiesbit, just the--extractor-argsargument formated as @Husenberg did above and from the same IP address at least, downloading does work. Not sure how long itâll last but even doing this once a day seems tolerable in order to get durable local files.Thanks for the tip!
For anyone on a data center IP, this is to be expected and thereâs nothing we can do about it.
But I have a question for anyone on a residential IP who is experiencing this issue:
What were your downloading habits like before you started getting the 403 errors? Were you downloading in bulk, e.g. large playlists/channels/batches? Concurrent downloads? Or did you just go to download a single video and got hit with the 403?Update: We have enough information on this for now, thanks. Please do not post further comments on this.
I get this too, and have had it for a few hours. If I try to play the video in a browser, it just loops adverts constantly, or sometimes thereâs a black window with spinner. Seems to be a bug on the youtube side. Also using yt-dlp updated from the master branch today.
Edit: Forcing IPv4 (
-4option) has worked for me today.