-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[Youtube] Got server error HTTP Error 403: Forbidden(latest master version) #32905
Comments
Indeed this seems to be a pathological video where almost all video formats fail on the first fragment and 299 may fail later, regardless of Python 2.7/3.5/3.9 and User-Agent settings. 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? |
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. |
So
|
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... >.> |
So has anyone tried fetching fragments in fragments of <1MB? We already had a work-around to download in fragments to avoid throttling IIRC. Otherwise:
|
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. |
This change is significant. I checked old, pre quantum Firefox and videos don't work any more, when 3 days ago they did. |
Maybe the new player JS uses some G JS syntax extension (aka ECMA2021+) that hadn't been contemplated in those FF versions. Is there an error in the JS console? |
It used to work as embedded or as mobile (when used mobile user agent). Now all of them display all saying error:
Loading any video at https://www.youtube.com/embed/1234567890a:
Then pressing play:
ED. If it's of any help, despite what was said before, there are some videos that work. First - this one doesn't, and gives following console log
This one does and, with this log:
So, after clicking 'play' it gives this error: |
No matter what chunk size I use I'm seeing hard 403 errors at 1Meg as others have reported - I'm able to download as many fragments as I want up to 1Meg and then get a 403. Have experimented with generating It feels like they've added a check somewhere which fails at the 1Meg mark but I haven't found anything yet where that might be. Checking via the browser I can see that youtube is happily downloading |
But in the browser the media links have the In line with step 1 above, I'm gradually pulling stuff from the yt-dlp extractor, enough to download HLS with client |
I'm not seeing a Edit: Looks like the playbackCookie / POST data is extracted from the bytes of the previous fragment response somehow |
This is the procedure that I am using in my own code. Load https://www.youtube.com/embed/<id#> and find the base.js link. Do the usual to extract the sig and n-sig. Extract the signatureTimestamp for the next step. Load https://www.youtube.com/youtubei/v1/player with the signatureTimestamp and TVHTML5_SIMPLY_EMBEDDED_PLAYER as the client name. If the JSON response contains "formats" and/or "adaptiveFormats" then we're good. This covers most videos, including age-gated ones. The 403 problem occurs when we have go to the next step. We can't use "www.youtube.com". We must use "m.youtube.com" with the user agent set to something like "Mozilla/5.0 (Android 14)" which is what I'm using. Load https://m.youtube.com/watch?v=<id#> and extract the JSON structures that you would otherwise have gotten from the previous step. And that's it. The extra step is only required for videos that disallow embedding. |
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 @8chanAnon's algorithm is what is currently done for age-gate videos, up to the last step with Step 2 will only work if |
Indeed, Android 14/FF 122 at m.youtube.com didn't list the |
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 There's a |
At least it would be good to have a program that is not not-youtube-dl while a long term solution to the twattery is being investigated. |
On a lot of websites I want to download from youtube-dl and curl dont even get the correct html, 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. |
Yes, but so far as captcha is generally understood (G/recaptcha, hacaptcha, Cloudflare challenge aka breaks the Web), that is not the problem. Even if it solved the |
Yeah not relevant here but I did bookmark it for other things, looks like a decent tool :) |
I only said that i run it in docker. |
…ccess Changes allow specifying a different (video) download format from the final audio format to persist on disk. Current stable youtube-dl has high download failures. See ytdl-org/youtube-dl#32905 to track issue. To fix that the song download command has been updated to improve download success. This has been verified to work with the nightly youtube-dl version 2024.08.07 (from ytdl-org/ytdl-nightly).
@dirkf I tried that and it works, thank you. Though just a note, I got an output that looks like this: 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 But when I try to download a playlist with this, I get the following:
|
@bstojkovic unless you are reporting the 403 in the original post, please get out. |
I'm sorry about that. I tried fixing this error by following this fix, which didn't work until I changed the user agent to match my browser's. Now it started downloading, but I again got the same 403 error after the first video:
|
|
Having all this in mind, I executed a new command, but still get the same problem.
I'm hoping I didn't follow the advice incorrectly. |
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 |
Thank you! I haven't visited this thread in quite some time. I just skimmed it, saw the part about changing the user agent, added that to my script, and youtube-dl is working again. At least for now. |
Well, it was nice while it lasted, but now it's throttled down to a crawl again. :( |
Adding
where my alias yd is
|
Same error with different flags like:
OR
|
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
Thank, that build worked great. |
Probably you were seeing the roll-out of the player JS as reported in #32986, with success depending on whether your request went to a server that was still sending the previous player. |
Oops, I spoke too soon. It worked fine in my two quick tests, as well as a video I downloaded later, now it's back to giving me 403 errors. |
Are you using the mobile UA option? If so, pls post verbose log. |
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: [] |
Checklist
Verbose log
Description
youtube-dl 'https://www.youtube.com/watch?v=lLSkbZ3-EOs'
The text was updated successfully, but these errors were encountered: