youtube-dl: [Youtube] Got server error HTTP Error 403: Forbidden(latest master version)

Checklist

  • I’m reporting a broken site support issue
  • I’ve verified that I’m running youtube-dl version 2024.08.07(the latest master version)
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar bug reports including closed ones
  • I’ve read bugs section in FAQ

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2024.08.07.local
[debug] Python 3.8.5 (CPython x86_64 64bit) - macOS-10.16-x86_64-i386-64bit - OpenSSL 1.1.1h  22 Sep 2020
[debug] exe versions: ffmpeg 7.0.1-tessus, ffprobe 6.1.1, rtmpdump 2.4
[debug] Proxy map: {'http': 'http://127.0.0.1:58309', 'https': 'http://127.0.0.1:58309'}
Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

PASTE VERBOSE LOG HERE

Description

  • The download will run normally for a short time, and then a 403 error will appear
youtube-dl 'https://www.youtube.com/watch?v=lLSkbZ3-EOs'
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 2 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 3 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 4 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 5 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 6 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 7 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 8 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 9 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 41 (attempt 10 of 10)...
[download] Skipping fragment 41...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 42 (attempt 1 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 42 (attempt 2 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 42 (attempt 3 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 42 (attempt 4 of 10)...

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 57
  • Comments: 158 (71 by maintainers)

Commits related to this issue

Most upvoted comments

I’m also experiencing this error, but when i changed the user-agent to: “Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36” (mobile user agent of the latest chrome version) it worked. Here is the exact line: youtube-dl --verbose -x --user-agent "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36"

The workaround with changing user agent unfortunately doesn’t work for me anymore

This just worked for me:

$ python3 -m youtube_dl -f mp4 --verbose -x --user-agent "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36" 'somevideo'

Is there an explanation of the bug in a way that doesn’t require hours of YouTube API context to understand? For me this simple example fails: youtube-dl 'https://www.youtube.com/watch?v=LbOve_UZZ54'.

Try with m.youtube.com or pass: --user-agent "Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0".

Works (for now…)

youtube-dl 'https://m.youtube.com/watch?v=LbOve_UZZ54'
[youtube] LbOve_UZZ54: Downloading webpage
[youtube] LbOve_UZZ54: Downloading player 2f238d39
[youtube] LbOve_UZZ54: Downloading API JSON
[youtube] LbOve_UZZ54: Downloading thumbnail ...
[youtube] LbOve_UZZ54: Writing thumbnail to: /dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.jpg
[dashsegments] Total fragments: 9
[download] Destination: /dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.f137.mp4
[download] 100% of 88.64MiB in 00:03
[dashsegments] Total fragments: 1
[download] Destination: /dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.m4a.f140.m4a
[download] 100% of 8.52MiB in 00:00
[ffmpeg] Merging formats into "/dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.mp4"
Deleting original file /dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.f137.mp4 (pass -k to keep)
Deleting original file /dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.m4a.f140.m4a (pass -k to keep)
[ffmpeg] Adding thumbnail to "/dev/shm/test-ytd/По полям Синий трактор едет к нам - Песенка мультик для детей.mp4"

Adding --user-agent "Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0" worked for me just now on a previously failing

11:18:03 ruby-3.2.2 (master) ~/Dropbox/-> yd https://www.youtube.com/watch?v=cKw_Rjtn3uc
[youtube] cKw_Rjtn3uc: Downloading webpage
[youtube] cKw_Rjtn3uc: Downloading player baafab19
[dashsegments] Total fragments: 1
[download] Destination: Addison Rae - Diet Pepsi (Kastra Remix) _ Lyric Video-cKw_Rjtn3uc.m4a
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 1 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 2 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 3 of 10)...

where my alias yd is

alias yd='cd /Users/myusername/Dropbox/ && youtube-dl -x --audio-quality 0 --audio-format mp3 --user-agent "Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0"'

Please don’t bother to supply any “me too” reports unless the log shows some novelty that may help with rectification. Just “Like”, or whatever, an existing similar report.

You can see how a poToken is being sent in POST data by the browser in the Invidious code that shows how to capture the value. But I understood from yt-dlp discussions that a pot query parameter was used in the media links associated with the pot-ified session.

@8ChanAnon’s algorithm is what is currently done for age-gate videos, up to the last step with m.youtube.com which is new and interesting. What happens if you skip straight to that step?

Step 2 will only work if TVHTML5_SIMPLY_EMBEDDED_PLAYER is not pot-ified, and that seems to be in question.

A tldr; may not be out of place, even if all this can be read above.

Many programs, including this one, use an internal YT API to provide services that cannot be supported through the official YT API. The internal API has been changed such that media links extracted using the WEB client (which, for now, we use) require a further challenge (the poToken) to be solved to avoid 403 after the first ~1MB. This (with similar things) is why a YT web page is several MB instead of 10kB. Using m.youtube.com may be a work-around until after “for now”.

Fixing this in line with the long established multi-client capability in yt-dlp is resulting in a long twisty set of commits that are not yet quite ready for PR.

To avoid 403 on the media download, you need a work-around, which is to use a UA like the one I showed, which causes YT to use its mobile web client. The downside is that the current extractor may not be able to extract playlists from the mobile page format. You could list the playlist IDs with --flat-playlist --get-id, not specifying any UA (add --get-title for a hint as to the content associated with each ID); then get each wanted audio item using the mobile UA and other parameters similar to what you have above. You should scroll back in the issue, I’m afraid, for all the details.

Eg, as recommended above:

$ python ./youtube-dl-20240807 -v -f worst --user-agent "Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0" 'https://www.youtube.com/watch?v=kXYiU_JCYtU'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-f', u'worst', u'--user-agent', u'Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0', u'https://www.youtube.com/watch?v=kXYiU_JCYtU']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2024.08.07 [c5098961b] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 2.7.15 (CPython i686 32bit) - Linux-6.1.0-25-686-pae-i686-with-debian-12.7 - OpenSSL 1.1.1a  20 Nov 2018 - glibc 2.1.3
[debug] exe versions: ffmpeg 5.1.6-0, ffprobe 5.1.6-0
[debug] Proxy map: {}
[youtube] kXYiU_JCYtU: Downloading webpage
[debug] [youtube] Extracting signature function js_4e23410d_111
[debug] [youtube] Decrypted nsig 1O1Wn95wSw3l8OOPq => LUFcn6QxaHNlcA
[debug] [youtube] Extracting signature function js_4e23410d_107
[debug] [youtube] Decrypted nsig PfQ_0IrIAbmdY0RdU => sycw0OfIXqltdA
[youtube] kXYiU_JCYtU: Downloading API JSON
[debug] Invoking downloader on u'https://rr4---sn-cu-aigss.googlevideo.com/videoplayback?rms=au%2Cau&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Ccnr%2Cratebypass%2Cdur%2Clmt&fexp=51312688%2C51326932%2C51331020&ei=M0EkZ6egLIyjxN8PlMiWiQ4&ip=46.208.6.93&spc=qtApAUkscXlyo10qaqfq4fL9r5f8KCOKNAUzi8RZ8VxDyOwHZlev6iVZlgkO5phAFQ&id=o-AOQ8FBJt864SE0hU9CX0iRntSSf-uzAKBfEav1m5f9if&txp=4538434&svpuc=1&cnr=14&xpc=EgVo2aDSNQ%3D%3D&requiressl=yes&ratebypass=yes&source=youtube&mv=m&sig=AJfQdSswRQIhAP5rWiN4bChxiE_DZNUDLvtmiGxpkGmIYQC0MR1-Hz27AiAiGNOGbcsy6z0EveUANoiDmsqT18vqtHX2Pfn-MTvdFA%3D%3D&dur=187.199&ns=-yo7AWoragEGZIMzEZ7aRiQQ&initcwndbps=1866250&vprv=1&lsig=ACJ0pHgwRgIhAKWWCU4so_kHWoakSMWkgJm8Yu91upadfoe6s58O4e_VAiEA49jND6fE-sbM6GI21pz3qCbv599a1mHuv1tB8Viyqvw%3D&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms%2Cinitcwndbps&lmt=1714824598048249&met=1730429235%2C&expire=1730450835&mime=video%2Fmp4&fvip=4&rqh=1&c=MWEB&sefc=1&mm=31%2C29&mn=sn-cu-aigss%2Csn-cu-c9id&mh=g0&n=LUFcn6QxaHNlcA&mt=1730428863&bui=AQn3pFRX6RQNmNJjh_xfZX0peIa_VHjLXYI4fntkjxfi12Sr5lDBTknVkeoL7xHPIYaxeIkFVXQvlhF9&pl=25&ms=au%2Crdu&mvi=4&itag=18'
[download] Destination: Numb (Official Music Video) [4K UPGRADE] – Linkin Park-kXYiU_JCYtU.mp4
[download] 100% of 9.72MiB in 00:08
$

The mobile UA work-around could cause metadata to be lost. Even if that doesn’t seem to be relevant, please check again with the real-soon-now PR and post any appropriate diagnostics there.

I’m also experiencing this error, but when i changed the user-agent to: “Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36” (mobile user agent of the latest chrome version) it worked. Here is the exact line: youtube-dl --verbose -x --user-agent "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36"

can confirm this works for me (youtube-dl proxy through tor-browser-bundle exit=de)

@bstojkovic unless you are reporting the 403 in the original post, please get out.

This project seems to have slowed down a lot. @dirkf is overwhelmed by issues and a lot of features and fixes have yet to be backported.

I think if you are not a legacy system user, it might be better to use yt-dlp instead. Otherwise you will have to wait.

Yes, because specifying a mobile UA redirects to m.youtube.com as above. Mozilla/5.0 (Android 14; Mobile; rv:115.0) Gecko/115.0 Firefox/115.0 is a shorter UA that has the same effect.

However the ytInitialData in the mobile page is stringified JSON rather than actual JSON as in the desktop page, and this causes an additional API call (I suspect that no valid data is returned).

Can confirm that a lot of the video-only formats are just being 403-ed in the middle with their downloads, resulting in me getting files that stop after about 10-20 minutes into the video, but still have full sized audio.

By now I have written something into my scripts to just pick format 18 as long as a flag is set, because i foresee this issue happening again in the future once it is eventually fixed… >.>

… Thanks a bunch 👍 ; can confirm that the latest nightly can indeed complete a download attempt:

yt-dl -f 136+140 "BYJTrtMg9qg" =>

[youtube] BYJTrtMg9qg: Downloading webpage
[youtube] BYJTrtMg9qg: Downloading TVHTML5 API JSON
[youtube] BYJTrtMg9qg: Downloading player 37364e28
[dashsegments] Total fragments: 2
[download] Destination: Glenn Fredly & Andi Rianto - Dibalas Dengan Dusta (Official Music Video)-BYJTrtMg9qg.f136.mp4
[download] 100% of 12.87MiB in 00:10
[dashsegments] Total fragments: 1
[download] Destination: Glenn Fredly & Andi Rianto - Dibalas Dengan Dusta (Official Music Video)-BYJTrtMg9qg.m4a.f140.m4a
[download] 100% of 3.78MiB in 00:03
[ffmpeg] Merging formats into "Glenn Fredly & Andi Rianto - Dibalas Dengan Dusta (Official Music Video)-BYJTrtMg9qg.mp4"
Deleting original file Glenn Fredly & Andi Rianto - Dibalas Dengan Dusta (Official Music Video)-BYJTrtMg9qg.f136.mp4 (pass -k to keep)
Deleting original file Glenn Fredly & Andi Rianto - Dibalas Dengan Dusta (Official Music Video)-BYJTrtMg9qg.m4a.f140.m4a (pass -k to keep)

😄

@nicolaasjan wrote:

I can confirm that the last video example from @FMecha works with the youtube-dl version built from the latest master:

… But have you actually attempted a download? 😉

can formats, other than 18, be fully downloaded (considering that one YT flag causes 403 failure after 1MB)?

yt-dl -vf 136+140 "BYJTrtMg9qg" =>

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ffmpeg-location', '.\\FFmpeg', '--external-downloader-args', '-v 8 -stats', '-vf', '136+140', 'BYJTrtMg9qg']
[debug] Encodings: locale cp1253, fs mbcs, out cp737, pref cp1253
[debug] youtube-dl version 2025.01.21 [63fb0fc41] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 3.4.4 (CPython x86 32bit) - Windows-Vista-6.0.6003-SP2 - OpenSSL 1.0.2d 9 Jul 2015
[debug] exe versions: ffmpeg n6.1-dev-2615-N-112499-ga76b409, ffprobe n6.1-dev-2615-N-112499-ga76b409, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] BYJTrtMg9qg: Downloading webpage
[youtube] BYJTrtMg9qg: Downloading TVHTML5 API JSON
[debug] [youtube] Extracting signature function js_6e1dd460_107
[debug] [youtube] Decrypted nsig Bzj_i0DDUpTWKisyb => ESh-TZPMvAWdlA
[debug] [youtube] Extracting signature function js_6e1dd460_111
[debug] [youtube] Decrypted nsig k_Of0XWt67DI45jTC => kjA6Odff7elycA
[debug] Invoking downloader on 'https://rr1---sn-4vguioxu-n3bz.googlevideo.com/videoplayback?mime=video%2Fmp4&mm=31%2C29&sefc=1&svpuc=1&met=1737510463%2C&rms=au%2Cau&dur=244.844&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms%2Cinitcwndbps&fvip=1&mn=sn-4vguioxu-n3bz%2Csn-nv47lnsk&fexp=51326932%2C51335594%2C51353498%2C51355912%2C51371294%2C51384461&ms=au%2Crdu&gir=yes&pl=18&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C271%2C278%2C313%2C394%2C395%2C396%2C397%2C398%2C399%2C400%2C401&ns=bj_li9XlU0Nhvib2F2yx7PcQ&keepalive=yes&source=youtube&clen=13495911&mv=m&ei=P06QZ9q6LIPsi9oPpMve6Q0&n=kjA6Odff7elycA&itag=136&mt=1737510061&lmt=1731107774736890&spc=9kzgDZ4367xx299ZGbO-J0D9bYk1m_Ks5vmSViqZSB8u0lVIea52k0WCUfQNtUUaOnfOrV0&xpc=EgVo2aDSNQ%3D%3D&vprv=1&lsig=AGluJ3MwRQIhALooqK491zjaOCtZGeyvwA3wjCgMVukg6P4-HFPmnOtyAiAatt8LLCmqz4uMM8_qofNr0KoNQyJbjlO8EwJwHDkCeQ%3D%3D&ip=REDACTED&c=WEB&requiressl=yes&id=o-AFG-FRUxP16g72HfV-_X05srZFahAUV-OLbu-Q993Krg&expire=1737532063&rqh=1&sig=AJfQdSswRgIhAPtpUL34tNPO8hYAxWsHluVcJYGbazqfLSVxaWK0BmCnAiEAvoQERBqd939CiiEjCIwGelTU276a6OuT4aFu6zyqb3k%3D&initcwndbps=1321250&bui=AY2Et-NROzskx6UXLGPzCqYUwuZPqqjdbAFTMxTZN4bHVixLd5bYkUUi-5YE0a6tJG0QH-6QQxNOTdEK&mh=0S&mvi=1&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt'
[dashsegments] Total fragments: 2
[download] Destination: Glenn Fredly & Andi Rianto - Dibalas Dengan Dusta (Official Music Video)-BYJTrtMg9qg.f136.mp4
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 1 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 2 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 3 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 4 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 5 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 6 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 7 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 8 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 9 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 10 of 10)...
ERROR: giving up after 10 fragment retries
  File "__main__.py", line 19, in <module>
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\__init__.py", line 477, in main
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\__init__.py", line 467, in _real_main
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 2258, in download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 872, in extract_info
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 879, in wrapper
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 986, in __extract_info
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 1020, in process_ie_result
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 1864, in process_video_result
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 142, in wrapper
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 2156, in process_info
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 2092, in dl
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\common.py", line 380, in download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\dash.py", line 78,in real_download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\common.py", line 175, in report_error
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 682, in report_error
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 634, in trouble

… so the answer is NO here 😢 …

When testing nowadays, there are 3 things to check rather than the 1 that used to be enough:

  • is the expected format list extracted?
  • does this happen without a high probability of Sign in to confirm you're not a bot?
  • can formats, other than 18, be fully downloaded (considering that one YT flag causes 403 failure after 1MB)?

It seems that the mobile UA work-around is failing now, though yt-dlp (2024-12-06) is able to pull the same listed formats. Testing video lLSkbZ3-EOs, I found format 18 was downloadable with the PR #32987 code, but I think there some videos that don’t have this not-really-suitable-for-a-55"-TV format.

At a guess, the other formats are no longer accessible in the mobile page, or the UA isn’t causing redirection: if they were found in the API JSON they would be listed but not downloadable because of not using sts, as noted above. More investigation needed, but it shouldn’t de-rail the rewrite when I have time to get back to it.

[debug] youtube-dl version 2021.12.17

Use the nightly version (is built from current source): https://github.com/ytdl-org/ytdl-nightly

Anything new on this?

I am using the latest snapshot and it’s still not working, I’m getting the same errors as in this issue.

In addition other formats such as 140 or 18 aren’t working as well. I’m getting the Unable to decode n-parameter there.

And interestingly, yt-dlp 2024.04.09 is working.

Edited to add:

This is the commandline I’m using:

youtube-dl --restrict-filenames -o "%(uploader)s-%(title)s-%(id)s-%(upload_date)s.%(ext)s" --cookies www.youtube.com_cookies.txt https://www.youtube.com/watch?v=650lXWfoPN8

I created the cookies file using the chrome extension “Get cookies.txt” right before I executed the command after visiting the uri I was about to download.

@PatrickJRed it still wouldn’t help with this situation, but it’s pretty simple to add another curl downloader, you should open another issue or make the PR yourself

@dirkf

yt-dlp 2024.08.06 still works, apparently. It has fancy networking that we can’t easily replicate: maybe punt to curl for all requests?

On a lot of websites I want to download from youtube-dl and curl dont even get the correct html, instead of the one i would get in my Browser , they receives a version that has the captcha.

Instead I have a bash-script that predownloads the non-captcha html via “https://github.com/lwthiker/curl-impersonate” (runs in docker container , i use tag: 0.5.2-ff-alpine)

AFAIK lwthiker/curl-impersonate is the only http client that completly impersonates an actual browser like firefox. A lot of the problems I had with 403 errors in youtube-dl where captchas triggered by http-client not being exactly like an official version of firefox or chrome 😃 (this might even be valid for fragment-downloads)

I don’t think it’s worth trying to get around the poToken, it will eventually be required in all clients.

I keep digging into base.js when I get some time trying to understand how the token is created, it does seem to be extracted from the bytes of at least the first video fragment as far as I can tell, but not all fragments?..

There’s a Uint8Array which appears to be the fragment response data?.. manipulated several times and then 82/84/68 bytes of that array are stored as playbackCookie which is then sent in the POST data

Update:

I just tried again, first time today, and the audio failed the first attempt, but worked on the second, and the video worked on the first try. Using youtube-dl.

I think there is something going on here too. Yesterday I downloaded about four videos (format 18, 20+ minutes each, no rate limit) in rather quick succession, but when I got to the fifth video, I noticed that it served me a new javascript (b191cf34) and immediately got a 403. This was roughly 24 hours ago, by the way. The javascript today is called 962b571b and still a 403.

It is possible that I got IP-blocked but I can still download with yt-dlp with the same IP. Just tested with a single video.

Everything was working well for me yesterday on 2025.02.28 but today I’m getting the same 403 error trying to download videos on every channel I try.

403 is now expected when nsig processing fails. This is a new issue related to player 9c6dfc4a; I can reproduce it with the same test video. Using yt-dl, there isn’t any work-around at the moment.

Regardless, it’s #32960.

Apologies @dirkf, I suppose I somehow managed to get onto this topic by following other links but I can see now why the message I’m getting is actually in reference to #32960 and not this one. Thanks for the correction! If there’s anything I can do to assist, I’d be happy to try and lend a hand.

Downloaded nightly just a moment ago and tried the same URL as user Vangelis66 posted. Resulted in: … ERROR: Sign in to confirm you’re not a bot …

This isn’t happening systematically: it’s not happening for me with either Py3.11 or Py2.7. All the considerations from #32960 apply.

Can confirm release 2025.01.23 makes youtube downloadable again. (tested with >10 videos from different channels)

@Linux2010 @dirkf So this issue can be be closed as completed/fixed ?

… But have you actually attempted a download? 😉

Oops… You’re right . It doesn’t work.

@Rekrullurker posted

…I’ve noticed that when it asks for a sign in, it runs through the various status messages that it prints fairly quickly, but when a download works, it usually pauses after the first couple lines are printed to the window.

That’s because the sign-in error comes when fetching the JSON containing the download links. The nsig challenge, which can take seconds, is executed only when processing those links. -v makes this apparent.

I can confirm that the last video example from @FMecha works with the youtube-dl version built from the latest master:

youtube-dl -vF BYJTrtMg9qg
[debug] System config: []
[debug] User config: ['--rm-cache-dir', '-i', '-o', '/dev/shm/test-ytd/%(title)s.%(ext)s', '-f', 'bestvideo[height<=1080][ext=mp4][vcodec^=avc]+bestaudio[ext=m4a]/best[ext=mp4]/best', '--no-mtime', '--embed-thumbnail', '--force-ipv4']
[debug] Custom config: []
[debug] Command-line args: ['-vF', 'BYJTrtMg9qg']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2025.01.20
[debug] Lazy loading extractors enabled
[debug] Single file build
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-5.15.0-130-generic-x86_64-with-glibc2.35 - OpenSSL 3.0.2 15 Mar 2022 - glibc 2.35
[debug] exe versions: ffmpeg N-118328-g504df09c34-20250120, ffprobe N-118328-g504df09c34-20250120, rtmpdump 2.4
[debug] Proxy map: {}
Removing cache dir /home/user/.cache/youtube-dl ...
[youtube] BYJTrtMg9qg: Downloading webpage
[youtube] BYJTrtMg9qg: Downloading TVHTML5 API JSON
[debug] [youtube] Extracting signature function js_6e1dd460_111
[youtube] BYJTrtMg9qg: Downloading player 6e1dd460
[debug] [youtube] Decrypted nsig I6jHYdh1q7OtXBjbU => kHJxeNV2EADScg
[debug] [youtube] Decrypted nsig o0TCe4UJHwfraViui => JBxzipOBdw19bQ
[debug] [youtube] Extracting signature function js_6e1dd460_107
[info] Available formats for BYJTrtMg9qg:
format code  extension  resolution note
249          webm       audio only audio_quality_low   51k , webm_dash container, opus  (48000Hz), 1.51MiB
250          webm       audio only audio_quality_low   69k , webm_dash container, opus  (48000Hz), 2.02MiB
140          m4a        audio only audio_quality_medium  129k , m4a_dash container, mp4a.40.2 (44100Hz), 3.78MiB
251          webm       audio only audio_quality_medium  135k , webm_dash container, opus  (48000Hz), 3.96MiB
160          mp4        256x128    144p   39k , mp4_dash container, avc1.4d400c, 30fps, video only, 1.15MiB
394          mp4        256x128    144p   52k , mp4_dash container, av01.0.00M.08, 30fps, video only, 1.54MiB
278          webm       256x128    144p   65k , webm_dash container, vp9, 30fps, video only, 1.93MiB
395          mp4        426x188    240p   65k , mp4_dash container, av01.0.00M.08, 30fps, video only, 1.92MiB
133          mp4        426x188    240p   78k , mp4_dash container, avc1.4d400d, 30fps, video only, 2.28MiB
242          webm       426x188    240p   92k , webm_dash container, vp9, 30fps, video only, 2.70MiB
396          mp4        640x284    360p  114k , mp4_dash container, av01.0.01M.08, 30fps, video only, 3.33MiB
134          mp4        640x284    360p  140k , mp4_dash container, avc1.4d401e, 30fps, video only, 4.10MiB
243          webm       640x284    360p  200k , webm_dash container, vp9, 30fps, video only, 5.86MiB
397          mp4        854x378    480p  190k , mp4_dash container, av01.0.04M.08, 30fps, video only, 5.57MiB
135          mp4        854x378    480p  242k , mp4_dash container, avc1.4d401e, 30fps, video only, 7.07MiB
244          webm       854x378    480p  279k , webm_dash container, vp9, 30fps, video only, 8.16MiB
398          mp4        1280x566   720p  327k , mp4_dash container, av01.0.05M.08, 30fps, video only, 9.56MiB
136          mp4        1280x566   720p  440k , mp4_dash container, avc1.4d401f, 30fps, video only, 12.87MiB
247          webm       1280x566   720p  504k , webm_dash container, vp9, 30fps, video only, 14.72MiB
399          mp4        1920x850   1080p  560k , mp4_dash container, av01.0.08M.08, 30fps, video only, 16.35MiB
248          webm       1920x850   1080p  814k , webm_dash container, vp9, 30fps, video only, 23.77MiB
137          mp4        1920x850   1080p 1152k , mp4_dash container, avc1.640028, 30fps, video only, 33.64MiB
400          mp4        2560x1134  1440p 1498k , mp4_dash container, av01.0.12M.08, 30fps, video only, 43.73MiB
271          webm       2560x1134  1440p 2082k , webm_dash container, vp9, 30fps, video only, 60.79MiB
401          mp4        3840x1700  2160p 2816k , mp4_dash container, av01.0.12M.08, 30fps, video only, 82.22MiB
313          webm       3840x1700  2160p 5765k , webm_dash container, vp9, 30fps, video only, 168.29MiB
18           mp4        640x284    360p  412k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz), 12.04MiB (best)

that I’m right now shoe-horning into yt-dl.

Seems to work (for now…). 😀️

youtube-dl -v Kr2HK_rurho
[debug] System config: []
[debug] User config: ['--rm-cache-dir', '-i', '-o', '/dev/shm/test-ytd/%(title)s.%(ext)s', '-f', 'bestvideo[height<=1080][ext=mp4][vcodec^=avc]+bestaudio[ext=m4a]/best[ext=mp4]/best', '--no-mtime', '--embed-thumbnail', '--force-ipv4', '--cookies', 'cookies.txt']
[debug] Custom config: []
[debug] Command-line args: ['-v', 'Kr2HK_rurho']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2025.01.15
[debug] Lazy loading extractors enabled
[debug] Single file build
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-5.15.0-130-generic-x86_64-with-glibc2.35 - OpenSSL 3.0.2 15 Mar 2022 - glibc 2.35
[debug] exe versions: ffmpeg N-118301-g851a84650e-20250113, ffprobe N-118301-g851a84650e-20250113, rtmpdump 2.4
[debug] Proxy map: {}
Removing cache dir /home/nico/.cache/youtube-dl ...
[youtube] Kr2HK_rurho: Downloading webpage
[youtube] Kr2HK_rurho: Downloading TVHTML5 API JSON
[youtube] Kr2HK_rurho: Downloading player 0b866fa6
[debug] [youtube] Decrypted nsig 9vuc06WSd4g24q8A => DPutHL0F5FYkWg
[debug] [youtube] Decrypted nsig s_8NWKjE4rk4adH2 => OE7n8z9PYILITg
[youtube] Kr2HK_rurho: Downloading thumbnail ...
[youtube] Kr2HK_rurho: Writing thumbnail to: /dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.jpg
[debug] Invoking downloader on 'https://rr3---sn-5hnekn7s.googlevideo.com/videoplayback?expire=1736949572&ei=5GqHZ6rgNvLk6dsPyYSK4A0&ip=<REDACTED>&id=o-AHQ9OKCt35TIK6j3mo2nkCihKSYoT0hy5h_6F-Y0ymNe&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C271%2C278%2C313&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&met=1736927972%2C&mh=8S&mm=31%2C26&mn=sn-5hnekn7s%2Csn-4g5edndl&ms=au%2Conr&mv=m&mvi=3&pl=16&rms=au%2Cau&initcwndbps=3952500&bui=AY2Et-NwxkxjCFIZmFEtJMYI1Cwk5sbZDRvM6kBI2AhoNo8pRLpOMR59Q2igMZt0k1vILq7RYAnduz3E&spc=9kzgDffBRsJBZa5o&vprv=1&svpuc=1&mime=video%2Fmp4&ns=joR9vUnT9ELW1s8t3MW4kS8Q&rqh=1&gir=yes&clen=70654451&dur=556.088&lmt=1723822457414094&mt=1736927562&fvip=2&keepalive=yes&lmw=1&fexp=51326932%2C51335594%2C51353498%2C51371294&c=TVHTML5&sefc=1&txp=4432434&n=OE7n8z9PYILITg&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRQIhAPMj7Cr8dhmJcTGPIN21h7D-RhiMRLmD147XijDBKGB8AiBu9XD3swNxXOfFU_t6H94qKVWAtxYB60M5HabdRzDvag%3D%3D&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms%2Cinitcwndbps&lsig=AGluJ3MwRAIgaj24HT0Hp3juHAnVyo0Law7tMeJLNfy8kaDl1vXYwYcCICkMvUBo7HQbGii6AIdYboRHr07cGtvc_1-DhNKdowOy'
[dashsegments] Total fragments: 7
[download] Destination: /dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.f137.mp4
[download] 100% of 67.38MiB in 00:03
[debug] Invoking downloader on 'https://rr3---sn-5hnekn7s.googlevideo.com/videoplayback?expire=1736949572&ei=5GqHZ6rgNvLk6dsPyYSK4A0&ip=<REDACTED>&id=o-AHQ9OKCt35TIK6j3mo2nkCihKSYoT0hy5h_6F-Y0ymNe&itag=140&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&met=1736927972%2C&mh=8S&mm=31%2C26&mn=sn-5hnekn7s%2Csn-4g5edndl&ms=au%2Conr&mv=m&mvi=3&pl=16&rms=au%2Cau&initcwndbps=3952500&bui=AY2Et-NwxkxjCFIZmFEtJMYI1Cwk5sbZDRvM6kBI2AhoNo8pRLpOMR59Q2igMZt0k1vILq7RYAnduz3E&spc=9kzgDffBRsJBZa5o&vprv=1&svpuc=1&xtags=drc%3D1&mime=audio%2Fmp4&ns=joR9vUnT9ELW1s8t3MW4kS8Q&rqh=1&gir=yes&clen=9001872&dur=556.141&lmt=1723814401078158&mt=1736927562&fvip=2&keepalive=yes&lmw=1&fexp=51326932%2C51335594%2C51353498%2C51371294&c=TVHTML5&sefc=1&txp=4432434&n=OE7n8z9PYILITg&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cxtags%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRQIhALjrFcK7Qos_Z4F4w7sevgH8tSonlKDObtq_TrbvL5dPAiApjd0guW_eH0zjlVs9zMp4CDKuxyfNMYQwVkGwqmKgmw%3D%3D&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms%2Cinitcwndbps&lsig=AGluJ3MwRAIgaj24HT0Hp3juHAnVyo0Law7tMeJLNfy8kaDl1vXYwYcCICkMvUBo7HQbGii6AIdYboRHr07cGtvc_1-DhNKdowOy'
[dashsegments] Total fragments: 1
[download] Destination: /dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.m4a.f140-drc.m4a
[download] 100% of 8.58MiB in 00:01
[ffmpeg] Merging formats into "/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.f137.mp4' -i 'file:/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.m4a.f140-drc.m4a' -c copy -map 0:v:0 -map 1:a:0 'file:/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.temp.mp4'
Deleting original file /dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.f137.mp4 (pass -k to keep)
Deleting original file /dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.m4a.f140-drc.m4a (pass -k to keep)
[ffmpeg] Adding thumbnail to "/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.mp4' -i 'file:/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.jpg' -c copy -map 0 -map 1 -disposition:v:1 attached_pic 'file:/dev/shm/test-ytd/Commodore Amiga 500 -  ACA500+ Accelerator Card - FULL REVIEW.temp.mp4'

OK, so that’s the version (2025.01.13) with the commit linked above, selecting the tv InnerTube client, that I’m right now shoe-horning into yt-dl.

At this point, YouTube is doing it intentionally, right? People report error 403, a fix/workaround is found, and then a few days later, 403 errors again.

LoL, but if you want, pay back to an open source program in some way, or somehow help a local charity.

Also, review #32960 for guidance on how to avoid further breakage.

Apparently the client parameters, including UA, need to be just right.

A temporary fix (that worked today) is included in PR #32987.

Yes, I am. After some more testing, it seems it only fails on some videos.

Here is the log from one such failure
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '--user-agent', 'Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0', 'https://www.youtube.com/watch?v=ZbelsTTZ0QE']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2024.12.10
[debug] Lazy loading extractors enabled
[debug] Single file build
[debug] Python 3.4.4 (CPython x86 32bit) - Windows-XP-5.1.2600-SP3 - OpenSSL 1.0.2d 9 Jul 2015
[debug] exe versions: ffmpeg N-105053-gc417616-Reino
[debug] Proxy map: {}
[youtube] ZbelsTTZ0QE: Downloading webpage
[debug] [youtube] Decrypted nsig J2T7YI_FVNuB1rbFlt => Pv42zso-RjFDsg
[debug] [youtube] Decrypted nsig nxJfsEvTaEBBjAFmdI => WmC7NoLmA6NMKg
[youtube] ZbelsTTZ0QE: Downloading API JSON
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://rr1---sn-j5caxoxu-i2oe.googlevideo.com/videoplayback?clen=197680715&mm=31%2C29&expire=1733936581&n=WmC7NoLmA6NMKg&fexp=51326932%2C51331020%2C51335594%2C51347747&initcwndbps=4651250&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398%2C399%2C597%2C598&xpc=EgVo2aDSNQ%3D%3D&svpuc=1&lmt=1705760126895911&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&fvip=3&spc=qtApAWdjprjT_XTFriEtZsm8lM2XNY_MngwQu6j_huq5MxvrU1ugSI3vLzFU6lXmSA&ei=ZXFZZ-PPKqy2kucPmIHVsQM&bui=AQn3pFRXKOA5CW96qDyDVdV3dApfkc7mOlIbyA7j1nTYH8ijcsOLxdF9T36pQPhmbz82eMcPRxZHpmQh&itag=137&source=youtube&mime=video%2Fmp4&rms=au%2Cau&c=MWEB&ms=au%2Crdu&txp=5432434&ip=24.44.111.244&rqh=1&requiressl=yes&vprv=1&mt=1733914628&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms%2Cinitcwndbps&dur=1500.766&sefc=1&mh=HJ&pl=22&ns=zaPT_foz9hIdg3hYUktMjtUQ&sig=AJfQdSswRQIgVQQuKslmNCAToTk32xo0BhhmykeTM9Hc224RFz8FguICIQCT9_lCgewMeljrIwTyxFkRH51YFwLaQhQo_eKtydbDfg%3D%3D&mvi=1&id=o-APJn1Cpo42KU0qexogywzXvkNWrnrhR-PjkDm8NlWR6q&met=1733914981%2C&mn=sn-j5caxoxu-i2oe%2Csn-ab5sznzs&keepalive=yes&lsig=AGluJ3MwRQIhAIJ2A-jh_4ASdk4JS9Yr-iMpNb0L1xPnd6WhAEHpTYqzAiBf7l6LEsMycV_iNln99MBXRFPRB-6s9u5YBbLko703Sw%3D%3D&gir=yes&mv=m'
[dashsegments] Total fragments: 19
[download] Destination: Top 20 Gorgeous Adult & Violent Classic Anime That Are  Beyond Awesome - Explored-ZbelsTTZ0QE.f137.mp4
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 1 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 2 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 3 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 4 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 5 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 6 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 7 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 8 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 9 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 10 of 10)...
ERROR: giving up after 10 fragment retries
  File "__main__.py", line 19, in <module>
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\__init__.py", line 477, in main
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\__init__.py", line 467, in _real_main
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 2254, in download
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 868, in extract_info
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 875, in wrapper
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 982, in __extract_info
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 1016, in process_ie_result
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 1860, in process_video_result
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 138, in wrapper
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 2152, in process_info
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 2088, in dl
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\downloader\common.py", line 380, in download
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\downloader\dash.py", line 78, in real_download
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\downloader\common.py", line 175, in report_error
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 678, in report_error
  File "C:\Users\nico\Desktop\youtube-dl_source\youtube_dl\YoutubeDL.py", line 630, in trouble

Thank, that build worked great.

I have installed ffmpeg (6/20/2018) in Winds11 “Edit the sys environment variables” in “Environment variables” then “Path” then “edit” then added the last two as pictured. (youtube-dl.exe ver 2024.8.7 nightly build). Screenshot 2024-11-28 121243

Now I am trying to only get mp3 files from YT and here is a screenshot of what issues I have in Windows Power Shell win power shell

@dirkf I tried that and it works, thank you.

Though just a note, I got an output that looks like this: 'Numb (Official Music Video) [4K UPGRADE] – Linkin Park.f18.mp4'. including the quotes, having to rename the file. Did I do something wrong?

Also, how do I get the audio part, preferably mp3, from youtube-dl, or do I have to use ffmpeg manually?

PS. Nvm, sorry, I had to replace single quotes with double quotes and use worstaudio.

But when I try to download a playlist with this, I get the following:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.youtube.com/playlist?list=PL1DA88121783E6DDE', '-v', '-f', 'worstaudio', '-o', '%(title)s.f%(format_id)s.%(ext)s', '--user-agent', 'Mozilla/5.0 (Android 14; Mobile; rv:128.0) Gecko/128.0 Firefox/128.0']
[debug] Encodings: locale cp1250, fs utf-8, out utf-8, pref cp1250
[debug] youtube-dl version 2024.08.07 [c5098961b]
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 3.13.0 (CPython AMD64 64bit) - Windows-11-10.0.26100-SP0 - OpenSSL 3.0.15 3 Sep 2024
[debug] exe versions: ffmpeg 7.1-full_build-www.gyan.dev, ffprobe 7.1-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube:tab] PL1DA88121783E6DDE: Downloading webpage
ERROR: Unable to extract yt initial data; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; see  https://github.com/ytdl-org/youtube-dl/#user-content-installation  on how to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
Traceback (most recent call last):
  File "C:\Users\bozos\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtube_dl\YoutubeDL.py", line 879, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\bozos\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtube_dl\YoutubeDL.py", line 975, in __extract_info
    ie_result = ie.extract(url)
  File "C:\Users\bozos\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtube_dl\extractor\common.py", line 571, in extract
    ie_result = self._real_extract(url)
  File "C:\Users\bozos\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtube_dl\extractor\youtube.py", line 3472, in _real_extract
    data = self._extract_yt_initial_data(item_id, webpage)
  File "C:\Users\bozos\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtube_dl\extractor\youtube.py", line 309, in _extract_yt_initial_data
    self._search_regex(
    ~~~~~~~~~~~~~~~~~~^
        (r'%s\s*%s' % (self._YT_INITIAL_DATA_RE, self._YT_INITIAL_BOUNDARY_RE),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         self._YT_INITIAL_DATA_RE), webpage, 'yt initial data'),
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bozos\AppData\Local\Programs\Python\Python313\Lib\site-packages\youtube_dl\extractor\common.py", line 1101, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract yt initial data; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; see  https://github.com/ytdl-org/youtube-dl/#user-content-installation  on how to update. Be sure to call youtube-dl with the --verbose option and include the complete output.

即使上面已经读完了这些内容,tldr; 也可能不会不合适。

许多程序(包括此程序)使用内部 YT API 来提供无法通过官方 YT API 支持的服务。内部 API 已更改,因此使用WEB客户端(目前我们使用)提取的媒体链接需要进一步poToken解决挑战( ),以避免在前 ~1MB 后出现 403 错误。这(以及类似的东西)就是为什么 YT 网页是几 MB 而不是 10kB。在“目前”之前,使用 m.youtube.com 可能是一种解决方法。

根据_yt-dlp_中长期建立的多客户端功能修复此问题,会导致出现一长串曲折的提交,这些提交尚未完全准备好进行 PR。

come on,baby, we need your solution, hurry, very thanks!

Not “just” asking but imputing motives, which is not relevant.

yt-dlp reports may well offer good evidence of YT site behaviour (and its YT extractor can test the known InnerTube clients). There is no adverse competition with yt-dlp since each project has its own goals and code is compatibly (un)licensed.

For avoidance of doubt, that is the end of this meta-discussion.

@xyzxye

yt-dlp 2024.04.09

Update to 2024.08.06 or later. If the issue persists open an issue on the yt-dlp issue tracker.

Because someone needs to take the time and port the improvements made to yt-dlp, over to youtube-dl. yt-dlp already switched away from the web client ~1 month ago and even before that used iOS as a secondary client. If you require the Python 2 compatibility, you will have to wait for these improvements to be ported to youtube-dl (or even contribute something yourself).

I outlined the solution to this problem two weeks ago. Guess I have to prove that my method works. I put together a little demo:

https://8chananon.github.io/dl/yt-extract.htm

It runs in your browser. For that reason, I have to use a proxy server but my proxy is blocked by Youtube due to having an Amazon IP address so the proxy has to route through another proxy which isn’t banned by YT. Five proxies have been provided and the app will cycle to the next one if it detects blocking (or the proxy stops working).

Note that videos that are pegged to the IP address won’t work because of the proxy (like these two: 8Pa9x9fZBtY and 0pKfxbCHLoU).

You can input a full URL or just the video ID. The app just dumps all of the itags (except itag 18) as links to the actual video/audio. Click a link to play it in a new tab. You can play the audio and the video in different tabs and synchronize them (LOL).

The code is, of course, in Javascript. Sorry about that but I don’t do Python. Also, the download speed seems to be throttled but videos play fine.

If you want itag 18 or you just want to play the video to check it out:

https://8chananon.github.io/dl/yt-player.htm

Just confirming, my Script still works and downloads Videos without needing to change things up.

Still does use the legacy video formats, which kills my mobile based home data plan though, so I really hope there is going to be a fix so i can use 240p on the longer vods again. (not rushing you, because i know how complicated this stuff can be, but I’m annoyed at youtube itself for causing this in the first place)

Unfortunately, the yt-dlp stage is worse than that of this project. any ‘left-right’ steps and you have broken code. any support as well. so no

Apparently the latest fix worked for not even a day, that doesn’t bode well. Personally I keep getting “giving up after 0 fragment retries” in my python stuff.

From what I read in yesterdays thread, it seems like this will just not work out with fake JS interpretation if they try to combat this in the slightest. Like, that almost doesn’t deserve the name attack vector, that’s an attack landscape.

I have that with every single video I try. Curiously enough format ‘18’ work all the time. Other formats that work are ‘136’, ‘137’, ‘248’ and/or ‘160’, but it depends on video - not always the case. Still, format ‘18’ is the most reliable to work.