question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Crunchyroll] ERROR: Unable to download webpage: HTTP Error 403: Forbidden

See original GitHub issue

Checklist

  • I’m reporting a broken site support
  • I’ve verified that I’m running youtube-dl version 2021.03.03
  • 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 issues including closed ones

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'best[format_id*=enUS]', '--playlist-start', '68', 'https://www.crunchyroll.com/attack-on-titan']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2021.03.03
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.18362
[debug] exe versions: ffmpeg N-93542-gecdaa4b4fa, ffprobe N-93542-gecdaa4b4fa
[debug] Proxy map: {}
[crunchyroll:playlist] attack-on-titan: Downloading webpage
ERROR: Unable to download webpage: HTTP Error 403: Forbidden (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpvjygsik_\build\youtube_dl\extractor\common.py", line 632, in _request_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpvjygsik_\build\youtube_dl\YoutubeDL.py", line 2275, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 470, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 580, in http_response
  File "C:\Python\Python34\lib\urllib\request.py", line 508, in error
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Python\Python34\lib\urllib\request.py", line 588, in http_error_default

Description

I came across this issue not too long ago. Haven’t been able to fix it on my own, so here I am. I’ve tried adding cookies.txt to the command line as well as the user agent, neither solved the issue.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
6cUbi57zcommented, Apr 4, 2021

It seems to be the __cf_bm cookie which is required. I generated a cookie file and removed them one by one until youtube-dl stopped working. I then removed all of the others and left just this cookie and it worked fine.

Seems this is a cloudflare cookie: https://support.cloudflare.com/hc/en-us/articles/200170156-Understanding-the-Cloudflare-Cookies#12345681

1reaction
Atemucommented, Apr 1, 2021

The problem seems to be that, when ytdl tries to GET i.e. /darling-in-the-franxx, CR (or CF) returns 403. This does not happen in the browser for the same URL.
Same is true when using a cookie exported from my browser session.

After a lot of trial and error, I’ve found a workaround though:
Set the --user-agent to your browser’s and pass your browser’s CR cookies to ytdl.

It’s fairly fragile (one slight difference in the UA string makes it 403 again and also invalidates the cookie file?) but looks to be working well enough.

Seems like CR is getting more sophisticated with blocking automated tools and they’ve had a DRM rollout looming for a while too…

Read more comments on GitHub >

github_iconTop Results From Across the Web

403 Trying to download from crunchyroll (with cookies) - Reddit
ERROR : Unable to download webpage: HTTP Error 403: Forbidden (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you...
Read more >
Error 403 when you access Windows Update - Microsoft Learn
Error 403 (Access Denied/Forbidden) occurs when you connect to Windows ... Disable security, download assistant, or web accelerator software.
Read more >
youtube-dl - Bytefreaks.net
exc_info()[2], cause=err) youtube_dl.utils.ExtractorError: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); ...
Read more >
Login - Crunchyroll
Email or Username. Password. Show. FORGOT PASSWORD? LOG IN. No account? CREATE ONE · Terms of Service · Privacy Policy; Cookie Consent Tool;...
Read more >
What is a 502 Bad Gateway Error (And How Can I Fix It)?
Try disabling all your extensions and then accessing the website. If the error disappears after that, then it's likely that a plugin is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found