Repository: yt-dlp/yt-dlp

Issue:
[crunchyroll] Error 403 Forbidden for all URLs
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I'm running yt-dlp version **2023.06.22** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Brazil

### Provide a description that is worded well enough to be understood

CR probably broke CR plugin... again.

I tryed to download lists for taking links for new episodes just to get a 403 error. Downloading episodes also don't work anymore.

KODI plugin is working fine. Website is working fine. Tested the PS4 app and also working fine.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
The nightly verbose:
yt-dlp.exe -vU
[debug] Command-line config: ['-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.06.27.202841 [5b4b92769] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-12-04-git-6c814093d8-full_build-www.gyan.dev (setts), ffprobe 2022-12-04-git-6c814093d8-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1852 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Available version: nightly@2023.06.27.202841, Current version: nightly@2023.06.27.202841
Current Build Hash: 9eb7dae08abf2a5c725c0635519bb9568f0892e6b2145850e16ecff62186b637
yt-dlp is up to date (nightly@2023.06.27.202841)

The output when trying to download anything (also for trying to retrieve playlist):
yt-dlp.exe -vU --cookies-from-browser vivaldi --sub-langs pt-BR --remux-video mkv --embed-subs -a "C:\animetemp\queue2.txt" -o "%(season)s - %(episode_number)s.%(ext)s" --paths "C:\animetemp"
[debug] Command-line config: ['-vU', '--cookies-from-browser', 'vivaldi', '--sub-langs', 'pt-BR', '--remux-video', 'mkv', '--embed-subs', '-a', 'C:\\animetemp\\queue2.txt', '-o', '%(season)s - %(episode_number)s.%(ext)s', '--paths', 'C:\\animetemp']
[debug] Batch file urls: ['https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.06.27.202841 [5b4b92769] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-12-04-git-6c814093d8-full_build-www.gyan.dev (setts), ffprobe 2022-12-04-git-6c814093d8-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[Cookies] Extracting cookies from vivaldi
[debug] Extracting cookies from: "C:\Users\tamod\AppData\Local\Vivaldi\User Data\Default\Network\Cookies"
[debug] Found local state file at "C:\Users\tamod\AppData\Local\Vivaldi\User Data\Local State"
[Cookies] Extracted 2856 cookies from vivaldi
[debug] cookie version breakdown: {'v10': 2856, 'other': 0, 'unencrypted': 0}
[debug] Proxy map: {}
[debug] Loaded 1852 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Available version: nightly@2023.06.27.202841, Current version: nightly@2023.06.27.202841
Current Build Hash: 9eb7dae08abf2a5c725c0635519bb9568f0892e6b2145850e16ecff62186b637
yt-dlp is up to date (nightly@2023.06.27.202841)
[crunchyroll] Extracting URL: https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping
[crunchyroll] Retrieving main page (lang=pt-br/)
ERROR: [crunchyroll] G0DUNJKE4: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
  File "yt_dlp\extractor\common.py", line 1111, in _download_webpage
  File "yt_dlp\extractor\common.py", line 1062, in download_content
  File "yt_dlp\extractor\common.py", line 896, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 853, in _request_webpage

  File "yt_dlp\extractor\common.py", line 835, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3786, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden

It's the same for version 2023.06.22.
```



Discussion:
The 403 errors are coming from Cloudflare; their fingerprinting is determining that yt-dlp is not a web browser and blocking its requests to Crunchyroll.

There is a workaround for this. It requires cookies from a browser with the same IP address that you will be using with yt-dlp. Here are the steps:

1. Refresh your cookies in browser by loading a Crunchyroll video page until the video starts playing. If you have not done this within the past 30 minutes, you will need to do it again

2. Find your browser's User-Agent string; you need the *entire* string (starting with `Mozilla/5.0`) and it needs to be up-to-date (i.e. if your browser updates, you'll need to get its new UA string with the current version)
     - the simplest way is to type "my user-agent" into duckduckgo, google, etc. 
     - for Firefox browsers, you can find the user-agent by navigating to `about:support`
     - for Chromium browsers, you can find it in `chrome://version` (or your vendor prefix like `brave://version`, etc)

3. Pass your browser's user-agent to yt-dlp with `--user-agent "USERAGENT"` along with `--cookies-from-browser firefox`
     - replace `USERAGENT` with your actual full user-agent string you got from step 2
     - replace `firefox` with the browser that you are using to browse Crunchyroll
     - Or, if you'd rather use a cookies file instead of having yt-dlp extract cookies from your browser, you can use the `--cookies` option, e.g. `--cookies cookies.txt`. Note that the cookies need to be exported from a fresh browser session (see step 1) *within the past 30 minutes*. See [the wiki for browser extension recommendations](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp)

PS: If you get an **`Unable to extract initial state`** error, you need to run `yt-dlp --update-to nightly` or [install master branch with pip](https://github.com/yt-dlp/yt-dlp/wiki/Installation#pip-master)

PPS: This appears to not work with MS edge. Use chrome/firefox
> This looks like a cloudflare issue, and I can't reproduce it. This has happened before, and has been temporary. Hopefully that's the case again.
> 
> Something you could try:
> 
> 1. refresh your CR cookies in browser
> 2. find your browser's user-agent string; you can type "what is my user-agent" into duckduckgo, google, etc
> 3. pass your browser's user-agent with `--user-agent "USERAGENT"` along with `--cookies-from-browser`

Ok, cookies refreshed. Also tested with another browser.
user agent added to code

Still forbidden...

```
yt-dlp.exe -vU --cookies-from-browser vivaldi --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Vivaldi/6.1.3035.111" --sub-langs pt-BR --remux-video mkv --embed-subs -a "C:\animetemp\queue2.txt" -o "%(season)s - %(episode_number)s.%(ext)s" --paths "C:\animetemp"
[debug] Command-line config: ['-vU', '--cookies-from-browser', 'vivaldi', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Vivaldi/6.1.3035.111', '--sub-langs', 'pt-BR', '--remux-video', 'mkv', '--embed-subs', '-a', 'C:\\animetemp\\queue2.txt', '-o', '%(season)s - %(episode_number)s.%(ext)s', '--paths', 'C:\\animetemp']
[debug] Batch file urls: ['https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.06.27.202841 [5b4b92769] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-12-04-git-6c814093d8-full_build-www.gyan.dev (setts), ffprobe 2022-12-04-git-6c814093d8-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[Cookies] Extracting cookies from vivaldi
[debug] Extracting cookies from: "C:\Users\tamod\AppData\Local\Vivaldi\User Data\Default\Network\Cookies"
[debug] Found local state file at "C:\Users\tamod\AppData\Local\Vivaldi\User Data\Local State"
[Cookies] Extracted 2819 cookies from vivaldi
[debug] cookie version breakdown: {'v10': 2819, 'other': 0, 'unencrypted': 0}
[debug] Proxy map: {}
[debug] Loaded 1852 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Available version: nightly@2023.06.27.202841, Current version: nightly@2023.06.27.202841
Current Build Hash: 9eb7dae08abf2a5c725c0635519bb9568f0892e6b2145850e16ecff62186b637
yt-dlp is up to date (nightly@2023.06.27.202841)
[crunchyroll] Extracting URL: https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping
[crunchyroll] Retrieving main page (lang=pt-br/)
ERROR: [crunchyroll] G0DUNJKE4: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
  File "yt_dlp\extractor\common.py", line 1111, in _download_webpage
  File "yt_dlp\extractor\common.py", line 1062, in download_content
  File "yt_dlp\extractor\common.py", line 896, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 853, in _request_webpage

  File "yt_dlp\extractor\common.py", line 835, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3786, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden
```
I can confirm that this is an issue at the moment. All links load and play fine in Chrome, Edge, and Firefox. In US Central timezone region. When using yt-dlp, all links produce the same error.

Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>);


> This looks like a cloudflare issue, and I can't reproduce it. This has happened before, and has been temporary. Hopefully that's the case again.
> 
> Something you could try:
> 
> 1. refresh your CR cookies in browser
> 2. find your browser's user-agent string; you can type "what is my user-agent" into duckduckgo, google, etc
> 3. pass your browser's user-agent with `--user-agent "USERAGENT"` along with `--cookies-from-browser`

FYI:
The --user-agent option hasn't worked with Crunchyroll for the last several months.
> The --user-agent option hasn't worked with Crunchyroll for the last several months.

It does though? Use it and add `--print-traffic` to your command. You'll see the UA you passed being sent with requests

still can't repro here
```shell
$ yt-dlp -F --cookies-from-browser firefox::dlp2 'https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping' 
[Cookies] Extracting cookies from firefox
[Cookies] Extracted 64 cookies from firefox
[crunchyroll] Extracting URL: https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping
[crunchyroll] Retrieving main page (lang=pt-br/)
[crunchyroll] Authenticating with grant_type=etp_rt_cookie
[crunchyroll] G0DUNJKE4: Downloading object info JSON (cms)
[crunchyroll] Retrieving signed policy
[crunchyroll] G0DUNJKE4: Downloading stream info JSON (signed cms)
[crunchyroll] To get all formats of a hardsub language, use "--extractor-args crunchyrollbeta:hardsub=<language_code or all>". See https://github.com/yt-dlp/yt-dlp#crunchyrollbeta-crunchyroll for more info
[crunchyroll] G0DUNJKE4: Downloading adaptive_hls HLS manifest
[crunchyroll] G0DUNJKE4: Downloading chapter info
[info] Available formats for G0DUNJKE4:
ID                EXT RESOLUTION FPS │   FILESIZE   TBR PROTO │ VCODEC      ACODEC    MORE INFO
───────────────────────────────────────────────────────────────────────────────────────────────
adaptive_hls-562  mp4 428x240     24 │ ~ 97.46MiB  562k m3u8  │ avc1.42c015 mp4a.40.2 [pt-BR]
adaptive_hls-1092 mp4 640x360     24 │ ~189.39MiB 1093k m3u8  │ avc1.4d401e mp4a.40.2 [pt-BR]
adaptive_hls-2091 mp4 848x480     24 │ ~362.62MiB 2092k m3u8  │ avc1.4d401f mp4a.40.2 [pt-BR]
adaptive_hls-4121 mp4 1280x720    24 │ ~714.46MiB 4122k m3u8  │ avc1.640028 mp4a.40.2 [pt-BR]
adaptive_hls-8108 mp4 1920x1080   24 │ ~  1.37GiB 8108k m3u8  │ avc1.640028 mp4a.40.2 [pt-BR]
```
Yeah, I used to use the --user-agent option with Crunchyroll out of habit since that was the best way to use the old platform, but several months back it caused it to throw a similar 403 forbidden error. Took it out and it has worked fine since then.

But yeah, I still get the same error/output as OP. It does not appear that you are using the Windows version? I'm not sure, but if not maybe you can try it from a Windows cmd shell and see how it goes.


```shell
yt-dlp -vU -F --extractor-args "crunchyrollbeta:hardsub=en-US,none" --cookies "cookies-crunchyroll-com.txt" -a "LinksCR.txt"
[debug] Command-line config: ['-vU', '-F', '--extractor-args', 'crunchyrollbeta:hardsub=en-US,none', '--cookies', 'cookies-crunchyroll-com.txt', '-a', 'LinksCR.txt']
[debug] Batch file urls: ['https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.06.22 [812cdfa06] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-106957-g27cffd16aa-20220521 (setts), ffprobe N-106957-g27cffd16aa-20220521
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1851 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.06.22, Current version: stable@2023.06.22
Current Build Hash: 37e7ffe204309357cfd1388b0e2c782a30e293ddd0f2761a9a8f6afa185b3566
yt-dlp is up to date (stable@2023.06.22)
[crunchyroll] Extracting URL: https://www.crunchyroll.com/pt-br/watch/G0DUNJKE4/scrambling-and-dripping
[crunchyroll] Retrieving main page (lang=pt-br/)
ERROR: [crunchyroll] G0DUNJKE4: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
  File "yt_dlp\extractor\common.py", line 1111, in _download_webpage
  File "yt_dlp\extractor\common.py", line 1062, in download_content
  File "yt_dlp\extractor\common.py", line 896, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 853, in _request_webpage

  File "yt_dlp\extractor\common.py", line 835, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3786, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden
```


Switching from Edge to a clean install of Firefox did solve the problem for me. Just to let you know.

Edit: The usage of --user-agent was necessary to make it work on Firefox! Using --user-agent with Edge did not solve the problem.
I had the same issue yesterday evening, but later in the night, it fixed itself only to appear now back.

It is hard to conclude if it is Crunchyroll's fault or Claudfare, but with random on/off and not for everyone, I think more in Cloudfare direction.
> This looks like a cloudflare issue, and I can't reproduce it. This has happened before, and has been temporary. Hopefully that's the case again.
> 
> Something you could try:
> 
>     1. refresh your CR cookies in browser
> 
>     2. find your browser's user-agent string; you can type "what is my user-agent" into duckduckgo, google, etc
> 
>     3. pass your browser's user-agent with `--user-agent "USERAGENT"` along with `--cookies-from-browser`

Thank you very much, this worked for me on Firefox on Linux.
> This looks like a cloudflare issue, and I can't reproduce it. This has happened before, and has been temporary. Hopefully that's the case again.
> 
> Something you could try:
> 
> 1. refresh your CR cookies in browser
> 2. find your browser's user-agent string; you can type "what is my user-agent" into duckduckgo, google, etc
> 3. pass your browser's user-agent with `--user-agent "USERAGENT"` along with `--cookies-from-browser`

How can I do this on the linux terminal? Is there anyway to copy cookies from other PC to linux?
> How can I do this on the linux terminal? Is there anyway to copy cookies from other PC to linux?

See [the wiki for browser extension recommendations](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp), or you can run `yt-dlp --cookies-from-browser firefox --cookies cookies.txt` on the other PC  and it will dump all of its cookies to `cookies.txt` (so be very careful with this file!).

However, if the linux pc and the other pc do not have the same IP address, the chances of this `--user-agent` + `--cookies` method working drop significantly
> Switching from Edge to a clean install of Firefox did solve the problem for me. Just to let you know.
> 
> Edit: The usage of --user-agent was necessary to make it work on Firefox! Using --user-agent with Edge did not solve the problem.

I confirm that using firefox as source of cookies and user-agent works. This seems to be a change on how CR are handling incoming requests. Probably related on how it is interpreting what is "genuine" and what is not. This may be caused by how yt-dlp handle this. I have no knoledge in this but at least it's a clue of what could be the problem now that CR seems to be exploiting this...

I tryed to overflow playlist requests by teling my script to check for new episodes in all tittles to see if CR is banning by lower number of requests (it's 50 last time I got one) and that's not the case.
> > How can I do this on the linux terminal? Is there anyway to copy cookies from other PC to linux?
> 
> See [the wiki for browser extension recommendations](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp), or you can run `yt-dlp --cookies-from-browser firefox --cookies cookies.txt` on the other PC and it will dump all of its cookies to `cookies.txt` (so be very careful with this file!).
> 
> However, if the linux pc and the other pc do not have the same IP address, the chances of this `--user-agent` + `--cookies` method working drop significantly

It seems now can only work with `--cookies-from-browser firefox`  which means directly using firefox's cookie, when only using user&password` -u -p ` always get 403 error, seems the login func is broken, which means it can't work without a desktop browser.

And it also get 403 when using a cookie from a firefox browser with a different IP address.
For some context: this 403 issue originally showed up last year, right after the site fully migrated from the old API to the "beta" API. I wrote about it here: https://github.com/yt-dlp/yt-dlp/pull/5294#issuecomment-1289735453
It has popped up a few times since then, but those times it was only a transient/temporary issue. It seems to be more widespread and long-lasting this time.

It's cloudflare fingerprinting. But if you have cookies from a browser that already has "passed" the cloudflare test, you can circumvent the fingerprint check by passing those cookies and the same user-agent as the browser. It's possible that only Firefox has been reported to work because there are additional http header checks done for chromium-based browsers (`Sec-CH-UA` etc maybe?)
> For some context: this 403 issue originally showed up last year, right after the site fully migrated from the old API to the "beta" API. I wrote about it here: [#5294 (comment)](https://github.com/yt-dlp/yt-dlp/pull/5294#issuecomment-1289735453) It has popped up a few times since then, but those times it was only a transient/temporary issue. It seems to be more widespread and long-lasting this time.
> 
> It's cloudflare fingerprinting. But if you have cookies from a browser that already has "passed" the cloudflare test, you can circumvent the fingerprint check by passing those cookies and the same user-agent as the browser. It's possible that only Firefox has been reported to work because there are additional http header checks done for chromium-based browsers (`Sec-CH-UA` etc maybe?)

I got a warning at CR site today about merging lists from Funimation. Maybe that's why things are strange. But also can't discard that yt-dlp have a problem because yt-dlp can't login directly anymore and no browser is failing in accessing CR.
> yt-dlp can't login directly anymore

This is because of the cloudflare fingerprinting. It's detecting that yt-dlp isn't a browser and blocking it. Hence the need to pass the user-agent and cookies from a browser.
> > yt-dlp can't login directly anymore
> 
> This is because of the cloudflare fingerprinting. It's detecting that yt-dlp isn't a browser and blocking it. Hence the need to pass the user-agent and cookies from a browser.

I tested the MrKrabat's KODI plugin (that isn't update for some years now) and it's working fine. And also isn't a browser. So maybe something else is the problem.
@tamodolo are you still able to download from CR? I've tried downloading firefox to test on it but still getting 403.

cmd line:
yt-dlp -vU "https://www.crunchyroll.com/pt-br/watch/GJWU2EK7Z/sparkling-fresh" --user-agent {myUserAgent} --cookie-from-web firefox

doesn't matter firefox // chrome // edge they are the same issue.

> I confirm that using firefox as source of cookies and user-agent works.

Seems after a while it also get 403 then need to open the browser and refresh the page then it work again.
I suspect that the Crunchyroll Cookies have been shortened to be valid for only 30 minutes. I was able to get downloads using the --user-agent "USERAGENT" along with --cookies-from-browser firefox, however it started to fail about 30 minutes in to downloads.

`[download] 100% of    1.38GiB in 00:03:32 at 6.65MiB/s
[Metadata] Adding metadata to "downloads\Wandering_Witch_-_The_Journey_of_Elaina\01\002 - The_Land_of_Mages(8).mp4"
[crunchyroll] Extracting URL: https://www.crunchyroll.com/watch/G14U4E27X/the-girl-as-pretty-as-a-flower--bottled-happiness
[crunchyroll] Authenticating with grant_type=etp_rt_cookie
ERROR: [crunchyroll] G14U4E27X: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U`

I then refreshed Firefox and played a short video segment and then it allowed me to download again for 30 minutes before failing again (Approx 8 episodes). Rinse and repeat the actions.

If you are playing through a recognized browser the browser would automatically update the authentication cookie upon trying to play a video. yt-dlp does not automatically refresh cookies from the site.

I am now limiting myself to 7 - 8 downloads at a time. [Batch list/ not concurrenty]

> @tamodolo are you still able to download from CR? I've tried downloading firefox to test on it but still getting 403.
> 
> cmd line: yt-dlp -vU "https://www.crunchyroll.com/pt-br/watch/GJWU2EK7Z/sparkling-fresh" --user-agent {myUserAgent} --cookie-from-web firefox
> 
> doesn't matter firefox // chrome // edge they are the same issue.

@BraveSail got a working solution for that. It's was the same here until I opened firefox.

@livelife68 I run 2 downloads at once. But not dare to try more than that.

edit: nightly release broke the season alias....
I've got the same problem from germany with credential and also cookie authentication. On Monday it still worked, so i think its like suggested that crunchyroll/cloudflare changed something.

credentials:

```
[debug] Command-line config: ['-vU', '-f', 'best', '--user-agent', 'Firefox', '--username', 'PRIVATE', '--password', 'PRIVATE', '--ffmpeg-location', '.\\ffmpeg\\bin\\ffmpeg.exe', '--batch-file', '.\\links.txt']
[debug] Batch file urls: ['https://www.crunchyroll.com/de/watch/GG1U2ZNEV/ray-of-despair-ray-of-hope', 'https://www.crunchyroll.com/de/watch/G7PU4J108/miranjo-and-the-demon--the-prince-and-his-treasures']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.06.22 [812cdfa06] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-03-24-git-28d011516b-full_build-www.gyan.dev (setts), ffprobe 2022-03-24-git-28d011516b-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
WARNING: "-f best" selects the best pre-merged format which is often not the best option.
         To let yt-dlp download and merge the best available formats, simply do not pass any format selection.
         If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning
[debug] Loaded 1851 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.06.22, Current version: stable@2023.06.22
Current Build Hash: 37e7ffe204309357cfd1388b0e2c782a30e293ddd0f2761a9a8f6afa185b3566
yt-dlp is up to date (stable@2023.06.22)
[crunchyroll] Getting session id
[crunchyroll] Logging in
[crunchyroll] Extracting URL: https://www.crunchyroll.com/de/watch/GG1U2ZNEV/ray-of-despair-ray-of-hope
[crunchyroll] Retrieving main page (lang=de/)
ERROR: [crunchyroll] GG1U2ZNEV: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
  File "yt_dlp\extractor\common.py", line 1111, in _download_webpage
  File "yt_dlp\extractor\common.py", line 1062, in download_content
  File "yt_dlp\extractor\common.py", line 896, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 853, in _request_webpage

  File "yt_dlp\extractor\common.py", line 835, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3786, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden
```

cookies (also tried the `--cookie-from-web firefox` option):

```
[debug] Command-line config: ['-vU', '-f', 'best', '--user-agent', 'firefox', '--cookies', '.\\cookies.txt', '--ffmpeg-location', '.\\ffmpeg\\bin\\ffmpeg.exe', '--batch-file', '.\\links.txt']
[debug] Batch file urls: ['https://www.crunchyroll.com/de/watch/GG1U2ZNEV/ray-of-despair-ray-of-hope', 'https://www.crunchyroll.com/de/watch/G7PU4J108/miranjo-and-the-demon--the-prince-and-his-treasures']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.06.22 [812cdfa06] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-03-24-git-28d011516b-full_build-www.gyan.dev (setts), ffprobe 2022-03-24-git-28d011516b-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
WARNING: "-f best" selects the best pre-merged format which is often not the best option.
         To let yt-dlp download and merge the best available formats, simply do not pass any format selection.
         If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning
[debug] Loaded 1851 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.06.22, Current version: stable@2023.06.22
Current Build Hash: 37e7ffe204309357cfd1388b0e2c782a30e293ddd0f2761a9a8f6afa185b3566
yt-dlp is up to date (stable@2023.06.22)
[crunchyroll] Extracting URL: https://www.crunchyroll.com/de/watch/GG1U2ZNEV/ray-of-despair-ray-of-hope
[crunchyroll] Retrieving main page (lang=de/)
ERROR: [crunchyroll] GG1U2ZNEV: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
  File "yt_dlp\extractor\common.py", line 1111, in _download_webpage
  File "yt_dlp\extractor\common.py", line 1062, in download_content
  File "yt_dlp\extractor\common.py", line 896, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 853, in _request_webpage

  File "yt_dlp\extractor\common.py", line 835, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3786, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden
```
Now I can only open the firefox and login to crunchyroll then use yt-dlp with `--cookie-from-web firefox`  and same IP address to avoid the 403 error.  Seems can only download normally in a short time.
My Firefox useragent string was out of date by a version. Updating it to match the browser the cookies came from solved it.
So i am on Windows 10 on Version 2023.06.22 of yt-dlp using following command (cookies on Firefox already remove and renewed for crunchyroll):

`.\yt-dlp.exe -vU -f best --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0" --cookies-from-browser firefox --cookies .\auto_cookies.txt --ffmpeg-location .\ffmpeg\bin\ffmpeg.exe --batch-file .\links.txt`

and trying to download some german dubbed episodes and getting the following error:

```
ERROR: [crunchyroll] GG1U2ZNEV: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
  File "yt_dlp\extractor\common.py", line 1111, in _download_webpage
  File "yt_dlp\extractor\common.py", line 1062, in download_content
  File "yt_dlp\extractor\common.py", line 896, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 853, in _request_webpage

  File "yt_dlp\extractor\common.py", line 835, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3786, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden

```

Anybody got any suggestions what the problem could be?

**Update:**

Ok it works now but not with the `--cookies-from-browser firefox` option. I've extracted the cookies with a browser addon on Firefox and used that cookie file and that worked. So the command that worked for me:

`.\yt-dlp.exe -vU -f best --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0" --cookies .\cookies.txt --ffmpeg-location .\ffmpeg\bin\ffmpeg.exe --batch-file .\links.txt`
@moeter87-real Could you test this method after half hour or an hour without renew the cookie manually?
> **Update:**
> 
> Ok it works now but not with the `--cookies-from-browser firefox` option. I've extracted the cookies with a browser addon on Firefox and used that cookie file and that worked. So the command that worked for me:

Same here. I use the Add-On cookies.txt, login in Crunchyroll, open a Stream and play it for five Seconds. Then export the Cookies with the Add-On and start the download

yt-dlp --cookies cookies.txt \
       --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0" \
       --write-description \
       --write-thumbnail \
       --sub-langs "de-DE" \
       --extractor-args "crunchyrollbeta:hardsub=de-DE" $URL1 $URL2 $URL3

In a second window i tried the same. And: Wow this works. 

moeter87-real: You are my Hero. The Tip with the Add-On helps. Thank You.

EDIT: After 30 Minutes you get ERROR 403 again. After refresh it works.
I used the "--user-agent" of my browser in the command, and it worked correctly! Thank you for the tips.
> So i am on Windows 10 on Version 2023.06.22 of yt-dlp using following command (cookies on Firefox already remove and renewed for crunchyroll):
> 
> `.\yt-dlp.exe -vU -f best --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0" --cookies-from-browser firefox --cookies .\auto_cookies.txt --ffmpeg-location .\ffmpeg\bin\ffmpeg.exe --batch-file .\links.txt`

I don't use cookies from browser but if you do aren't you meant to omit --cookies ?
> > **Update:**

> EDIT: After 30 Minutes you get ERROR 403 again. After refresh it works.

Confirmed but not only that.
It seems that the cookies get updated every time a new video is played.
Strange, the error occurred again
I thought it was resolved just by using the --user-agent, I have no idea what it could be.
![image](https://github.com/yt-dlp/yt-dlp/assets/45123500/18dee142-9f45-459d-8f39-7e6e574c4835)

> Strange, the error occurred again I thought it was resolved just by using the --user-agent, I have no idea what it could be. ![image](https://user-images.githubusercontent.com/45123500/250352846-18dee142-9f45-459d-8f39-7e6e574c4835.png)

You need to refresh the cookies directly on firefox. Open something and it'll work again. yt-dlp need to implement this feature to work without this.
It worked when I did it the way you mentioned. However, for me, it only works if I use the same type of user agent that was used to generate the cookies. In other words, cookies from the Firefox browser only worked for me with "--user-agent "firefox"", whereas using the "edge" agent resulted in an error 🤔
To clarify it to everyone: Crunchyroll has changed the access to the videos. You need a cookie that is at max. 30 minutes old and includes your login to the page. The cookie itself is updated everytime you open a CR Website in your browser. If you open a link with yt-dlp the cookies aren't updated, because yt-dlp is not a browser itself and just uses the cookies of the browser you give in the options. And at least on my system, I have to use Firefox at the moment, because Edge does not work, even if I use --cookies-from-browser edge and the correct --user-agent option for my browser.

I don't think, this can be updated in yt-dlp easily to work like before. yt-dlp isn't a full feature web-browser and I wonder if it will be possible at all to keep the cookie updated by yt-dlp.

So as far as I see, there's only one option to download from CR at this time:
- use Firefox
- have an up to date cookie for CR website (max. 30 minutes old)
- use --cookies-from-browser firefox
- use --user-agent "..."
- the value of the --user-agent option must fit to the browser, you generated the cookie with

If you know any other working scenario, feel free to report here.
> To clarify it to everyone: Crunchyroll has changed the access to the videos. You need a cookie that is at max. 30 minutes old and includes your login to the page. The cookie itself is updated everytime you open a CR Website in your browser. If you open a link with yt-dlp the cookies aren't updated, because yt-dlp is not a browser itself and just uses the cookies of the browser you give in the options. And at least on my system, I have to use Firefox at the moment, because Edge does not work, even if I use --cookies-from-browser edge and the correct --user-agent option for my browser.
> 
> I don't think, this can be updated in yt-dlp easily to work like before. yt-dlp isn't a full feature web-browser and I wonder if it will be possible at all to keep the cookie updated by yt-dlp.
> 
> So as far as I see, there's only one option to download from CR at this time:
> 
> * use Firefox
> * have an up to date cookie for CR website (max. 30 minutes old)
> * use --cookies-from-browser firefox
> * use --user-agent "..."
> * the value of the --user-agent option must fit to the browser, you generated the cookie with
> 
> If you know any other working scenario, feel free to report here.

Or yt-dlp could implement the console API instead. But the mice and cat struggle probably will make it won't work anymore for MrKrabat's KODI unoficial plugin. Also, I don't know if it's possible to download soft subs with this method.

Just to be fair, CR is a very unreliable service. If they just work at any time I would be much less inclined to use a method like this just to be sure that I'll be able to watch something... Also, not being able to fix resolution and not alow it to be changed during stream makes me mad. And CR more often than not will send 720p even when 1080p is possible just because it's cheaper to them. And that's my personal reason to give CR the middle finger. If they at some time give me ways to whatch it in glorious max quality then I'll probably won't use yt-dlp anymore...
Hello,

I found a workaround. 

I try with **ytdl-patched version stable@2023.06.11.1686453250** (and **2023.07.02.1688268193**)

```shell
ytdl-patched --cookies-from-browser firefox --socket-timeout 120 --cookies cookies.txt -U https://www.crunchyroll.com/fatestrange-fake-whispers-of-dawn-/fatestrange-fake-whispers-of-dawn-inconnue-904607 --no-download -s --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0' --no-update
```

```shell
[Cookies] Extracting cookies from firefox
[Cookies] Extracted 32 cookies from firefox
[generic] Extracting URL: https://www.crunchyroll.com/fr/fatestrange-fake-whispers-of-dawn-/fatestrange-fake-whispers-of-dawn-inconnue-904607
[generic] fatestrange-fake-whispers-of-dawn-inconnue-904607: Downloading webpage
[redirect] Following redirect to https://www.crunchyroll.com/watch/GX9UQZE17/
[crunchyroll] Extracting URL: https://www.crunchyroll.com/watch/GX9UQZE17/
[crunchyroll] Retrieving main page (lang=None)
[crunchyroll] Authenticating with grant_type=etp_rt_cookie
[crunchyroll] GX9UQZE17: Downloading object info JSON (cms)
[crunchyroll] Retrieving signed policy
[crunchyroll] GX9UQZE17: Downloading stream info JSON (signed cms)
[crunchyroll] To get all formats of a hardsub language, use "--extractor-args crunchyrollbeta:hardsub=<language_code or all>". See https://github.com/yt-dlp/yt-dlp#crunchyrollbeta-crunchyroll for more info
[crunchyroll] GX9UQZE17: Downloading adaptive_hls HLS manifest
[crunchyroll] GX9UQZE17: Downloading chapter info
[info] GX9UQZE17: Downloading 1 format(s): adaptive_hls-8100
```

But if i try with **http://** it doesn't work anymore.

```shell
[Cookies] Extracting cookies from firefox
[Cookies] Extracted 32 cookies from firefox
[generic] Extracting URL: http://www.crunchyroll.com/fr/fatestrange-fake-whispers-of-dawn-/fatestrange-fake-whispers-of-dawn-inconnue-904607
[generic] fatestrange-fake-whispers-of-dawn-inconnue-904607: Downloading webpage
ERROR: [generic] None: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/ytdl-patched/ytdl-patched/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
```

For testing purposes you can try ;

```shell
sudo curl -L https://github.com/ytdl-patched/ytdl-patched/releases/latest/download/ytdl-patched -o /usr/local/bin/ytdl-patched
sudo chmod a+rx /usr/local/bin/ytdl-patched
```

_Notes_ :

- Same IP and Firefox in CLI/GUI with X11 for cookies.txt was used.
- Not working with **yt-dlp version stable@2023.06.22**
- Works with the latest of **ytdlp-patched 2023.07.02.1688268193**
- Env : **Debian 12 - Mozilla Firefox 102.12.0esr - ytdlp-patched 2023.07.02.1688268193**
- Works 4 hours after so far.
@ArturiaPendragon What is this ytdlp patched you're using?
@tamodolo **ytdlp-patched 2023.07.02.1688268193** or **2023.06.11.1686453250** works for me.

Found here : https://github.com/ytdl-patched/ytdl-patched/releases/tag/2023.07.02.1688268193
> @tamodolo **ytdlp-patched 2023.07.02.1688268193** or **2023.06.11.1686453250** works for me.
> 
> Found here : https://github.com/ytdl-patched/ytdl-patched/releases/tag/2023.07.02.1688268193

Thanks! But just to be sure as I didn't understood the workaround you found was for as https is the default behavior on yt-dlp. The workaround you found was for the 30 minute cookies limit or for something else?
I use by default the RSS from Crunchyroll and it's http and not https, when i tried with https + ytdlp-patched with --cookies-from-browser firefox --cookies cookies.txt (and good user-agent and same IP) it's works again for me. (So, its my workaround for 403 Forbidden ;))
Use cookies and user agent from a legit browser. That worked for me.
Will there anything be done about this. Or can anything be done?
> Will there anything be done about this. Or can anything be done?

As for a no input workaround I just added a pass to my script that open firefox on CR main site. It's working but it's not ideal. Just a dirty patch.
> What about the ytdlp-patched WA?

They did one? afaik it works the same and have the same problem as MASTER.
> My bad, I just read that it worked but not tried. Anyway the selenium trick restarting CR site did not worked for me

You need to use firefox as browser and pass the user agent. Something like this:

--cookies-from-browser firefox --user-agent "put it here quotes included". You can get your user agent on duckduckgo asking "what is my user agent"
> I know, already using --cookies-from-browser and --user-agent since last year but after 8 dwl ore 30 minutes i need to refresh

yeah, that's why I put that in my script. I finish long queues with a firefox filled with tabs of CR.
For me it's working fine with ytdl-patched (works for last days)
```python
from curl_cffi import requests

requests.get(
        url,
        impersonate="chrome110",
    )
``` 

Setting like I do when requesting resolves this issue
> ```python
> from curl_cffi import requests
> 
> requests.get(
>         url,
>         impersonate="chrome110",
>     )
> ```
> 
> Setting like I do when requesting resolves this issue

 Can you please elaborate on how/where exactly you perform this setting?
> ```python
> from curl_cffi import requests
> 
> requests.get(
>         url,
>         impersonate="chrome110",
>     )
> ```
> 
> Setting like I do when requesting resolves this issue

we have discussed about the possibility adding support for curl-impersonate sometime in the future. requires #2861 and some other things to be done before though.
Another way is to request api through beta-api.crunchyroll.com without being intercepted (but this method can only request api)
I somehow still can't reproduce this (I don't have an account):
```
yt-dlp https://www.crunchyroll.com/watch/G64P1GE8R/fortune-is-unpredictable-and-mutable --simulate --verbose
[debug] Command-line config: ['https://www.crunchyroll.com/watch/G64P1GE8R/fortune-is-unpredictable-and-mutable', '--simulate', '--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.07.06.194006 [92315c037] (linux_exe)
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-6.4.2-surface-x86_64-with-glibc2.37 (OpenSSL 3.1.1 30 May 2023, glibc 2.37)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[crunchyroll] Extracting URL: https://www.crunchyroll.com/watch/G64P1GE8R/fortune-is-unpredictable-and-mutable
[crunchyroll] Retrieving main page (lang=None)
[debug] [crunchyroll] Using cxApiParam=cr_web
[crunchyroll] Authenticating with grant_type=client_id
[crunchyroll] G64P1GE8R: Downloading object info JSON (cms)
[crunchyroll] Retrieving signed policy
[crunchyroll] G64P1GE8R: Downloading stream info JSON (signed cms)
[crunchyroll] To get all formats of a hardsub language, use "--extractor-args crunchyrollbeta:hardsub=<language_code or all>". See https://github.com/yt-dlp/yt-dlp#crunchyrollbeta-crunchyroll for more info
[crunchyroll] G64P1GE8R: Downloading adaptive_hls HLS manifest
[crunchyroll] G64P1GE8R: Downloading chapter info
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] G64P1GE8R: Downloading 1 format(s): adaptive_hls-6560
```


> As for a no input workaround I just added a pass to my script that open firefox on CR main site. It's working but it's not ideal. Just a dirty patch.

For those who love using scripts, I believe curl is capable of generating valid cookies if you pass an invalid* user agent to it. For example, this should work, but I can't test it:
```
curl https://www.crunchyroll.com/ -c crunchyrollcookies.txt -H "User-Agent: ujhgtfjhgfbv"
yt-dlp URL --cookies crunchyrollcookies.txt --add-header "User-Agent: ujhgtfjhgfbv"
```
(don't bother editing the URL sent to Curl, any Crunchyroll URL should generate working cookies)

*I'm not joking, Crunchyroll blocks curl if it's using a valid chrome user agent. I guess it can identify that Curl isn't Chrome, but it can't identify that Curl isn't `ujhgtfjhgfbv` (or any other random string)
On that note, I highly doubt this will work, but can someone who's experiencing this issue please test if `--add-header "User-Agent: ujhgtfjhgfbv"` (with no cookies) fixes it
> > ```python
> > from curl_cffi import requests
> > 
> > requests.get(
> >         url,
> >         impersonate="chrome110",
> >     )
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > Setting like I do when requesting resolves this issue
> 
> we have discussed about the possibility adding support for curl-impersonate sometime in the future. requires #2861 and some other things to be done before though.

This is not the setting of yt-dlp, this is my program for accessing the crunchyroll api, it can be accessed normally if I do it like this, otherwise there will be a 403 error,I'm sure this is the correct solution
> I'm sure this is the correct solution

Yes, adding support for Curl Impersonate is the ultimate solution to this problem. It can't be added until https://github.com/yt-dlp/yt-dlp/pull/2861 is merged, but that PR is actually extremely close to being ready to be merged!
> On that note, I highly doubt this will work, but can someone who's experiencing this issue please test if `--add-header "User-Agent: ujhgtfjhgfbv"` (with no cookies) fixes it

Also, can someone please test if cookies from Brave browser work, since Brave is based on Chrome but seems to send less headers
> It can't be added until #2861 is merged, but that PR is actually extremely close to being ready to be merged!

It only adds the framework that would be needed to support this. Actually adding support would be quite a ways away.
> On that note, I highly doubt this will work, but can someone who's experiencing this issue please test if `--add-header "User-Agent: ujhgtfjhgfbv"` (with no cookies) fixes it

Doesent work for me :/


> > On that note, I highly doubt this will work, but can someone who's experiencing this issue please test if `--add-header "User-Agent: ujhgtfjhgfbv"` (with no cookies) fixes it
> 
> Also, can someone please test if cookies from Brave browser work, since Brave is based on Chrome but seems to send less headers

Also doesent work for me :/
> Also doesent work for me :/

Did you pass Brave's `--user-agent`, after visiting Crunchyroll at least once?
whoops, visiting crunchyroll once won't work, you have to have visited it within the last few minutes

Do you get a "checking your browser" page every time you visit crunchyroll in brave?
For me: yes - I can't even pass this "checking your browser" page from Brave browser.
@rdamas do you have javascript disabled or something?
Also, can you access kick.com (an unrelated site that also uses cloudflare ddos protection)
No, kick.com has the same issues. No, javascript is enabled, and joyn.de (e.g.) works perfectly well in brave with the same settings.
It's somewhat a waste of time disabling javascript nowadays. You can't possibly scape it anymore. The internet is javascript now. So disabling it will give more headaches that will solve without it. Also, the extra "privacy" you think it gives is ilusion. You put a cable in your PC, end of privacy period.
@rdamas does kick.com work in guest mode (click the 3 lines in the top right and then click `open guest window`, which is on top of the zoom controls)?

It sounds like you have some setting that's making cloudflare DDOS protection hate you, and I'm really curious what that setting is? Are you using a VPN? Do you get that same screen in a different browser (in incognito mode)?
Works in private mode of the browser; it seems they can detect the installed "VideoDownloadHelper" extension. When deactivated, kick.com works.

Crunchyroll is usable in private mode as well, and I could download a video with yt-dlp using --cookies-from-browser brave and braves' user agent string. Platform: MacOs.
> I could download a video with yt-dlp using --cookies-from-browser brave and braves' user agent string

So, just to clarify, the download works with `--cookies-from-browser brave` (with brave's user agent, right after visiting the site and going through that screen), but not `--cookies-from-browser chrome` (with chrome's user-agent, right after visiting the site and going through that screen)?

If that's the case, can you please compare https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending in both browsers, and try passing all the headers that only chrome has to yt-dlp, using `--add-header 'HEADER: VALUE'` (eg `--add-header 'SEC-CH-UA: "Not.A/Brand";v="8", "Chromium";v="114"'`)
Need to reinstall chrome first - haven't used chrome since ages. I'll check.

Update: Unfortunately (?) downloading a video using --cookies-from-browser chrome works for me as well. 
If anyone can reproduce this and can test if https://github.com/yt-dlp/yt-dlp/pull/7595 can help to fix this that would be greatly appreciated.

In this dev branch you can hackily force curl-impersonate to be used for all urls with a env var for testing:

`YT_DLP_CCI_IMPERSONATE=chrome110 yt-dlp -v URL`
Same cookie file, same machine, 

NOT WORKING using Windows, command running in Powershell (yt-dlp --version, 2023.07.06) 

![image](https://github.com/yt-dlp/yt-dlp/assets/6680464/22a9a107-6fe5-4f4b-b40e-1e72a59a5d2b)

<details><summary>-v output.</summary>

```
[debug] Command-line config: ['--cookies', 'D:/Crunchyroll/www.crunchyroll.com_cookies.txt', '--print', '%(season_number)s;%(season)s;%(episode_number)s;%(episode)s;%(webpage_url)s;%(playlist_autonumber)s', '--no-download', '--no-warnings', '--match-filter', 'language=ja-JP', '--extractor-args', 'crunchyrollbeta:hardsub=es-ES', 'https://www.crunchyroll.com/es/series/G63K98PZ6/one-punch-man', '-v']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (pip)
[debug] Python 3.11.4 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1u  30 May 2023)
[debug] exe versions: phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[crunchyroll:playlist] Extracting URL: https://www.crunchyroll.com/es/series/G63K98PZ6/one-punch-man
[crunchyroll:playlist] Retrieving main page (lang=es/)
ERROR: [crunchyroll:playlist] G63K98PZ6: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\common.py", line 710, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\crunchyroll.py", line 476, in _real_extract
    **traverse_obj(self._call_api(f'series/{internal_id}', internal_id, lang, 'series'), ('data', 0, {
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
    result = self._call_base_api(
             ^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
    self._update_query(lang)
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\crunchyroll.py", line 69, in _update_query
    webpage = self._download_webpage(
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\common.py", line 1113, in _download_webpage
    return self.__download_webpage(url_or_request, video_id, note, errnote, None, fatal, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\common.py", line 1064, in download_content
    res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\common.py", line 898, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\common.py", line 855, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "C:\Python311\Lib\site-packages\yt_dlp\extractor\common.py", line 837, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\yt_dlp\YoutubeDL.py", line 3863, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\urllib\request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\urllib\request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Python311\Lib\urllib\request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
``` 

</details>


WORKING using Ubuntu, command running in WSL2 ubuntu shell (yt-dlp --version, 2023.07.06) 

![image](https://github.com/yt-dlp/yt-dlp/assets/6680464/4a8720e8-f80a-4dac-8873-eb6e980d6720)

<details><summary>-v output.</summary>

```
[debug] Command-line config: ['--cookies', '/mnt/d/Crunchyroll/www.crunchyroll.com_cookies.txt', '--print', '%(season_number)s;%(season)s;%(episode_number)s;%(episode)s;%(webpage_url)s;%(playlist_autonumber)s', '--no-download', '--no-warnings', '--match-filter', 'language=ja-JP', '--extractor-args', 'crunchyrollbeta:hardsub=es-ES', 'https://www.crunchyroll.com/es/series/G63K98PZ6/one-punch-man', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481]
[debug] Lazy loading extractors is disabled
[debug] Python 3.10.6 (CPython x86_64 64bit) - Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 (OpenSSL 3.0.2 15 Mar 2022, glibc 2.35)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, secretstorage-3.3.1, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[crunchyroll:playlist] Extracting URL: https://www.crunchyroll.com/es/series/G63K98PZ6/one-punch-man
[crunchyroll:playlist] Retrieving main page (lang=es/)
[debug] [crunchyroll:playlist] Using cxApiParam=cr_web
[crunchyroll:playlist] Authenticating with grant_type=client_id
[crunchyroll:playlist] G63K98PZ6: Downloading series JSON (cms)
[download] Downloading playlist: One-Punch Man
[crunchyroll:playlist] Retrieving signed policy
[crunchyroll:playlist] G63K98PZ6: Downloading seasons JSON (signed cms)
[crunchyroll:playlist] GR9PC2PJX: Downloading episode list JSON (signed cms)
[crunchyroll:playlist] G6X0C47XK: Downloading episode list JSON (signed cms)
[crunchyroll:playlist] G6P509G96: Downloading episode list JSON (signed cms)
[crunchyroll:playlist] Playlist One-Punch Man: Downloading 37 items of 37
[download] One-Punch Man (French Dub) Episode 1 – El hombre más poderoso del mundo does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 2 – El androide solitario does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 3 – El científico tenaz does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 4 – El ninja moderno does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 5 – El gran profesor does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 6 – El guerrero extremo does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 7 – El aprendiz supremo does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 8 – Rey del Mar Profundo does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 9 – Justicia indomable does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 10 – Peligro sin precedentes does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 11 – Conquistador del universo does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (French Dub) Episode 12 – El mayor héroe does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 1 – El retorno del héroe does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 2 – El monstruo humano does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 3 – Empieza la caza does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 4 – Bate Metálico does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 5 – Torneo de artes marciales does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 6 – La sublevación de los monstruos does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 7 – Héroe de clase S does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 8 – La resistencia de los fuertes does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 9 – Las preocupaciones del más fuerte does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 10 – Asedio justiciero does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 11 – El orgullo de cada uno does not pass filter (language=ja-JP), skipping ..
[download] One-Punch Man (Season 2) (French Dub) Episode 12 – Responsabilizarse por un discípulo does not pass filter (language=ja-JP), skipping ..
[download] Downloading item 25 of 37
[crunchyroll] Extracting URL: https://www.crunchyroll.com/es/watch/GR247ZD96
[crunchyroll] GR247ZD96: Downloading object info JSON (cms)
[crunchyroll] GR247ZD96: Downloading stream info JSON (signed cms)
[crunchyroll] To get all formats of a hardsub language, use "--extractor-args crunchyrollbeta:hardsub=<language_code or all>". See https://github.com/yt-dlp/yt-dlp#crunchyrollbeta-crunchyroll for more info
[crunchyroll] GR247ZD96: Downloading adaptive_hls-hardsub-es-ES HLS manifest
[crunchyroll] GR247ZD96: Downloading chapter info
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
....
```

</details>
@fe80Grau cookies expire after 30 minutes. Have you run that multiple times to make sure it's not just random? Which OS and browser created the cookies?
EDIT: Is it possible Linux is running from the latest commit and windows is running from the latest stable?
I have tryed it. Its always 30 min after refreshing the page in your browser/ making a new request and starting the ytdlp session.
@JajajTec tried what?
Oh sorry, i was in a hurry.
I have tryed it with multiple browsers: chrome, brave, firefox
All are the same. The cookies work for 30min after the last request the browser made (refreshing/loading a link, getting a video fragment) and inport into ytdlp.
That means if you keep a video playing in the background and make ytdlp reload the cookies every 30 min, it would work no prob.
Hmm. Crunchy went through a maintenance outage about an hour ago. Now I get this error message, no matter what I try. Looks like support for Crunchy is gone for the moment...

ERROR: [crunchyroll] G14U4WXJ9: Unable to extract initial state; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U

Anyone else having this problem or is it just me?

EDIT: I've just opened Crunchy in my Edge Browser and the Crunchy Website displayed a message "Your device has been trusted." or something like that (already closed the message and can't reproduce it). 
@Killua-Zolldyck having the same problem
It's the same here now.

I tested MrKrabat's KODI plugin and still works. This plugin is amazing haha!

This is the verbose:

```
yt-dlp.exe` -v --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0" --cookies-from-browser firefox --sub-langs pt-BR --remux-video mkv --embed-subs https://www.crunchyroll.com/pt-br/watch/GK9U3MVX8 -o "%(season)s - %(episode_number)s.%(ext)s" --paths "C:\animetemp"
[debug] Command-line config: ['-v', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0', '--cookies-from-browser', 'firefox', '--sub-langs', 'pt-BR', '--remux-video', 'mkv', '--embed-subs', 'https://www.crunchyroll.com/pt-br/watch/GK9U3MVX8', '-o', '%(season)s - %(episode_number)s.%(ext)s', '--paths', 'C:\\animetemp']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.06.22 [812cdfa06] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-12-04-git-6c814093d8-full_build-www.gyan.dev (setts), ffprobe 2022-12-04-git-6c814093d8-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[Cookies] Extracting cookies from firefox
[debug] Extracting cookies from: "C:\Users\tamod\AppData\Roaming\Mozilla\Firefox\Profiles\dxxfcfla.default-release-1688405545434\cookies.sqlite"
[Cookies] Extracted 228 cookies from firefox
[debug] Proxy map: {}
[debug] Loaded 1851 extractors
[crunchyroll] Extracting URL: https://www.crunchyroll.com/pt-br/watch/GK9U3MVX8
[crunchyroll] Retrieving main page (lang=pt-br/)
ERROR: [crunchyroll] GK9U3MVX8: Unable to extract initial state; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 708, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 72, in _update_query
  File "yt_dlp\extractor\common.py", line 1270, in _search_json
  File "yt_dlp\extractor\common.py", line 1256, in _search_regex
```
The `initial state` extractor bug is being tracked in its own issue, and there is a patch available here:
https://github.com/yt-dlp/yt-dlp/issues/7624#issuecomment-1638912586

Can confirm: the patch works for me.
Compiled master with patch. Confirm that works.
Same here. Compiled with the patch from 'bashonly'. Can confirm the patch. Works fine.
> Good news: Cloudflare 403s are gone(?)

They're still there if you use  `--user-agent curl/7`. Perhaps crunchyroll just reduced their settings :eyes: 
I wonder what I am doing wrong.
I got a fresh copy from the main page, I changed lines as per _bashonly_ suggestion.
And I am still getting 404 (even with Firefox cookies, as it worked yesterday fine)

<details>
<summary>Stack trace</summary>

```C:\***\yt-dlp-master\yt-dlp-master\yt-dlp.cmd --cookies-from-browser edge -F https://www.crunchyroll.com/mobile-suit-gundam-the-witch-from-mercury/episode-23-unrelenting-tenderness-905987 --verbose
[debug] Command-line config: ['--cookies-from-browser', 'edge', '-F', 'https://www.crunchyroll.com/mobile-suit-gundam-the-witch-from-mercury/episode-23-unrelenting-tenderness-905987', '--verbose']
Extracting cookies from edge
[debug] Extracting cookies from: "C:\***\AppData\Local\Microsoft\Edge\User Data\Default\Network\Cookies"
[debug] Found local state file at "C:\***\AppData\Local\Microsoft\Edge\User Data\Local State"
Extracted 2966 cookies from edge
[debug] cookie version breakdown: {'v10': 2966, 'other': 0, 'unencrypted': 0}
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481]
[debug] Lazy loading extractors is disabled
[debug] Python 3.11.2 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1s  1 Nov 2022)
[debug] exe versions: ffmpeg 6.0-essentials_build-www.gyan.dev (setts), ffprobe 6.0-essentials_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[generic] Extracting URL: https://www.crunchyroll.com/mobile-suit-gundam-the-witch-from-mercury/episode-23-unrelenting-tenderness-905987
[generic] episode-23-unrelenting-tenderness-905987: Downloading webpage
ERROR: [generic] None: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\extractor\common.py", line 715, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\extractor\generic.py", line 2430, in _real_extract
    full_response = self._request_webpage(url, video_id, headers={
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\extractor\common.py", line 860, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\networking\_urllib.py", line 432, in _send
    res = opener.open(urllib_req, timeout=float(request.extensions.get('timeout') or self.timeout))

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\AlexI\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AlexI\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "C:\Users\AlexI\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AlexI\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Users\AlexI\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\YoutubeDL.py", line 4059, in urlopen
    return self._request_director.send(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\networking\common.py", line 89, in send
    response = handler.send(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\networking\_helper.py", line 203, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\networking\common.py", line 297, in send
    return self._send(request)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\networking\_urllib.py", line 437, in _send
    raise HTTPError(UrllibResponseAdapter(e.fp), redirect_loop='redirect error' in str(e)) from e
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\extractor\common.py", line 847, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\***\yt-dlp-master\yt-dlp-master\yt_dlp\YoutubeDL.py", line 4078, in urlopen
    raise _CompatHTTPError(e) from e
yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 403: Forbidden```

</details>
@Burve Try passing the `--user-agent` of the browser you are loading cookies from
hmm, it looks like the user agent helps. and works with edge
@bashonly I'm not used to compiling python scripts. Is there any chance, there will be a nightly release including the patch?
Not sure why but I got this error for the first time today (maybe because I was already using both --cookies 'pathto/cookies.txt' and  --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78'
Today I got the same error as everybody else even with [bashonly](https://github.com/bashonly) fix (I was able to compile my exe, but the error is the same) I think there is still a problem with the script:

````
[debug] Command-line config: ['https://www.crunchyroll.com/it/watch/G50UZ10D5', '--username', 'PRIVATE', '--password', 'PRIVATE', '--write-subs', '--sub-langs', 'it-IT', '--prefer-ffmpeg', '--no-check-certificate', '--cookies', 'PathToCookieFile\\cookies.txt', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78', '--verbose']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (py2exe)
[debug] Python 3.11.0 (CPython AMD64 64bit) - Windows-10-10.0.19045 (OpenSSL 1.1.1q  5 Jul 2022)
[debug] exe versions: ffmpeg git-2020-08-02-b48397e, ffprobe git-2020-08-02-b48397e, rtmpdump 2.3
[debug] Optional libraries: brotli-1.0.9, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[crunchyroll] Extracting URL: https://www.crunchyroll.com/it/watch/G50UZ10D5
[crunchyroll] Retrieving main page (lang=it/)
ERROR: [crunchyroll] G50UZ10D5: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.pyc", line 715, in extract
  File "yt_dlp\extractor\crunchyroll.pyc", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.pyc", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.pyc", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.pyc", line 69, in _update_query
  File "yt_dlp\extractor\common.pyc", line 1118, in _download_webpage
  File "yt_dlp\extractor\common.pyc", line 1069, in download_content
  File "yt_dlp\extractor\common.pyc", line 903, in _download_webpage_handle
  File "yt_dlp\extractor\common.pyc", line 860, in _request_webpage

  File "yt_dlp\networking\_urllib.pyc", line 432, in _send
  File "urllib\request.pyc", line 525, in open
  File "urllib\request.pyc", line 634, in http_response
  File "urllib\request.pyc", line 563, in error
  File "urllib\request.pyc", line 496, in _call_chain
  File "urllib\request.pyc", line 643, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.pyc", line 4059, in urlopen
  File "yt_dlp\networking\common.pyc", line 89, in send
  File "yt_dlp\networking\_helper.pyc", line 203, in wrapper
  File "yt_dlp\networking\common.pyc", line 297, in send
  File "yt_dlp\networking\_urllib.pyc", line 437, in _send
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "yt_dlp\extractor\common.pyc", line 847, in _request_webpage
  File "yt_dlp\YoutubeDL.pyc", line 4078, in urlopen
yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 403: Forbidden
````

> Not sure why but I got this error for the first time today (maybe because I was already using both --cookies 'pathto/cookies.txt' and --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78' Today I got the same error as everybody else even with [bashonly](https://github.com/bashonly) fix (I was able to compile my exe, but the error is the same) I think there is still a problem with the script:
> 
> ```
> [debug] Command-line config: ['https://www.crunchyroll.com/it/watch/G50UZ10D5', '--username', 'PRIVATE', '--password', 'PRIVATE', '--write-subs', '--sub-langs', 'it-IT', '--prefer-ffmpeg', '--no-check-certificate', '--cookies', 'PathToCookieFile\\cookies.txt', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78', '--verbose']
> [debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
> [debug] yt-dlp version stable@2023.07.06 [b532a3481] (py2exe)
> [debug] Python 3.11.0 (CPython AMD64 64bit) - Windows-10-10.0.19045 (OpenSSL 1.1.1q  5 Jul 2022)
> [debug] exe versions: ffmpeg git-2020-08-02-b48397e, ffprobe git-2020-08-02-b48397e, rtmpdump 2.3
> [debug] Optional libraries: brotli-1.0.9, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
> [debug] Proxy map: {}
> [debug] Loaded 1855 extractors
> [crunchyroll] Extracting URL: https://www.crunchyroll.com/it/watch/G50UZ10D5
> [crunchyroll] Retrieving main page (lang=it/)
> ERROR: [crunchyroll] G50UZ10D5: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
>   File "yt_dlp\extractor\common.pyc", line 715, in extract
>   File "yt_dlp\extractor\crunchyroll.pyc", line 320, in _real_extract
>   File "yt_dlp\extractor\crunchyroll.pyc", line 114, in _call_api
>   File "yt_dlp\extractor\crunchyroll.pyc", line 99, in _call_base_api
>   File "yt_dlp\extractor\crunchyroll.pyc", line 69, in _update_query
>   File "yt_dlp\extractor\common.pyc", line 1118, in _download_webpage
>   File "yt_dlp\extractor\common.pyc", line 1069, in download_content
>   File "yt_dlp\extractor\common.pyc", line 903, in _download_webpage_handle
>   File "yt_dlp\extractor\common.pyc", line 860, in _request_webpage
> 
>   File "yt_dlp\networking\_urllib.pyc", line 432, in _send
>   File "urllib\request.pyc", line 525, in open
>   File "urllib\request.pyc", line 634, in http_response
>   File "urllib\request.pyc", line 563, in error
>   File "urllib\request.pyc", line 496, in _call_chain
>   File "urllib\request.pyc", line 643, in http_error_default
> urllib.error.HTTPError: HTTP Error 403: Forbidden
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "yt_dlp\YoutubeDL.pyc", line 4059, in urlopen
>   File "yt_dlp\networking\common.pyc", line 89, in send
>   File "yt_dlp\networking\_helper.pyc", line 203, in wrapper
>   File "yt_dlp\networking\common.pyc", line 297, in send
>   File "yt_dlp\networking\_urllib.pyc", line 437, in _send
> yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "yt_dlp\extractor\common.pyc", line 847, in _request_webpage
>   File "yt_dlp\YoutubeDL.pyc", line 4078, in urlopen
> yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 403: Forbidden
> ```

bashonly fix only the initial state, for 403 the workaround is to use a cookie form the browser and refresh it every 30min.


> Not sure why but I got this error for the first time today (maybe because I was already using both --cookies 'pathto/cookies.txt' and --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78' Today I got the same error as everybody else even with [bashonly](https://github.com/bashonly) fix (I was able to compile my exe, but the error is the same) I think there is still a problem with the script:
> 
> ```
> [debug] Command-line config: ['https://www.crunchyroll.com/it/watch/G50UZ10D5', '--username', 'PRIVATE', '--password', 'PRIVATE', '--write-subs', '--sub-langs', 'it-IT', '--prefer-ffmpeg', '--no-check-certificate', '--cookies', 'PathToCookieFile\\cookies.txt', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78', '--verbose']
> [debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
> [debug] yt-dlp version stable@2023.07.06 [b532a3481] (py2exe)
> [debug] Python 3.11.0 (CPython AMD64 64bit) - Windows-10-10.0.19045 (OpenSSL 1.1.1q  5 Jul 2022)
> [debug] exe versions: ffmpeg git-2020-08-02-b48397e, ffprobe git-2020-08-02-b48397e, rtmpdump 2.3
> [debug] Optional libraries: brotli-1.0.9, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
> [debug] Proxy map: {}
> [debug] Loaded 1855 extractors
> [crunchyroll] Extracting URL: https://www.crunchyroll.com/it/watch/G50UZ10D5
> [crunchyroll] Retrieving main page (lang=it/)
> ERROR: [crunchyroll] G50UZ10D5: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
>   File "yt_dlp\extractor\common.pyc", line 715, in extract
>   File "yt_dlp\extractor\crunchyroll.pyc", line 320, in _real_extract
>   File "yt_dlp\extractor\crunchyroll.pyc", line 114, in _call_api
>   File "yt_dlp\extractor\crunchyroll.pyc", line 99, in _call_base_api
>   File "yt_dlp\extractor\crunchyroll.pyc", line 69, in _update_query
>   File "yt_dlp\extractor\common.pyc", line 1118, in _download_webpage
>   File "yt_dlp\extractor\common.pyc", line 1069, in download_content
>   File "yt_dlp\extractor\common.pyc", line 903, in _download_webpage_handle
>   File "yt_dlp\extractor\common.pyc", line 860, in _request_webpage
> 
>   File "yt_dlp\networking\_urllib.pyc", line 432, in _send
>   File "urllib\request.pyc", line 525, in open
>   File "urllib\request.pyc", line 634, in http_response
>   File "urllib\request.pyc", line 563, in error
>   File "urllib\request.pyc", line 496, in _call_chain
>   File "urllib\request.pyc", line 643, in http_error_default
> urllib.error.HTTPError: HTTP Error 403: Forbidden
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "yt_dlp\YoutubeDL.pyc", line 4059, in urlopen
>   File "yt_dlp\networking\common.pyc", line 89, in send
>   File "yt_dlp\networking\_helper.pyc", line 203, in wrapper
>   File "yt_dlp\networking\common.pyc", line 297, in send
>   File "yt_dlp\networking\_urllib.pyc", line 437, in _send
> yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "yt_dlp\extractor\common.pyc", line 847, in _request_webpage
>   File "yt_dlp\YoutubeDL.pyc", line 4078, in urlopen
> yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 403: Forbidden
> ```

This is the prior error 403 this topic is about. To workaround it use a real browser cache (command --cookies-from-browser). Firefox and Edge are known to work (I didn't tested Edge but Firefox works here). You need to use that with it's real --user-agent. You can get what it the browser user agent by searching "What is my user agent" in duckduckgo search engine. Then log in on CR using firefox and try to use yt-dlp (cookies last for 30 minutes)
>
> 
> bashonly fix only the initial state, for 403 the workaround is to use a cookie form the browser.

> This is the prior error 403 this topic is about. To workaround it use a real browser cache (command --cookies-from-browser). Firefox and Edge are known to work (I didn't tested Edge but Firefox works here). You need to use that with it's real --user-agent. You can get what it the browser user agent by searching "What is my user agent" in duckduckgo search engine. Then log in on CR using firefox and try to use yt-dlp (cookies last for 30 minutes)



Ah so the cookie generated by yt-dlp will not work?
Also I notice it now that my cookie generated is edited by yt-dlp when I use --cookie 'pathtocookie'... not sure why... I used to just create that file from my webview in my own interface so I'm not sure if I can still use my own or of I need to use yt-dlp generated file
> > bashonly fix only the initial state, for 403 the workaround is to use a cookie form the browser.
> 
> Ah so the cookie generated by yt-dlp will not work? Also I notice it now that my cookie generated is edited by yt-dlp when I use --cookie 'pathtocookie'... not sure why... I used to just create that file from my webview in my own interface so I'm not sure if I can still use my own or of I need to use yt-dlp generated file

yt-dlp isn't a real browser so it won't update the cookies ever. Use firefox instead and the commands I wrote in my previous comment.
> yt-dlp isn't a real browser so it won't update the cookies ever. User firefox instead and the commands I wrote in my previous comment.

Ok I got the initial state error now (so I should be able to fix it with bashonly fix
But I still got a question.
Since I can still generate a cookie.txt file from a real browser (a webview that use edge)... how can I use that file instead of the one generated by yt-dlp or from a supported browser? In previous version yt-dlp did not generate a cookie.txt file when I used --cookie it just readed my file... now it will ovverride it... I think my own cookie file should work file. Do you know if there is any way to use it?

> > yt-dlp isn't a real browser so it won't update the cookies ever. User firefox instead and the commands I wrote in my previous comment.
> 
> Ok I got the initial state error now (so I should be able to fix it with bashonly fix But I still got a question. Since I can still generate a cookie.txt file from a real browser (a webview that use edge)... how can I use that file instead of the one generated by yt-dlp or from a supported browser? In previous version yt-dlp did not generate a cookie.txt file when I used --cookie it just readed my file... now it will ovverride it... I think my own cookie file should work file. Do you know if there is any way to use it?

Because CR limit cookies to 30 minutes you'll have to generate cookies.txt whatever you want to use yt-dlp. It's an extra step doing that way. Just leave Firefox logged at your account and open CR site when you want to use yt-dlp. If you have a script that calls yt-dlp, add a line to open firefox on CR site and that's it.
> > > yt-dlp isn't a real browser so it won't update the cookies ever. User firefox instead and the commands I wrote in my previous comment.
> > 
> > 
> > Ok I got the initial state error now (so I should be able to fix it with bashonly fix But I still got a question. Since I can still generate a cookie.txt file from a real browser (a webview that use edge)... how can I use that file instead of the one generated by yt-dlp or from a supported browser? In previous version yt-dlp did not generate a cookie.txt file when I used --cookie it just readed my file... now it will ovverride it... I think my own cookie file should work file. Do you know if there is any way to use it?
> 
> Because CR limit cookies to 30 minutes you'll have to generate cookies.txt whatever you want to use yt-dlp. It's an extra step doing that way. Just leave Firefox logged at your account and open CR site when you want to use yt-dlp. If you have a script that calls yt-dlp, add a line to open firefox on CR site and that's it.

I don't need to... My interface just extract a cookies.txt file pressing a button from my webview and it will also extract the user-agent at the same time... I made it just for me to use yt-dl (before yt-dlp). If I can still use that cookie.txt file I will... if I cannot use it anymore because there is no way to do it I will change the interface... I just want to be sure I have to change it.
No way to use my own cookie.txt file?
PS. I can confirm that it work with Opera browser too.
> > > > yt-dlp isn't a real browser so it won't update the cookies ever. User firefox instead and the commands I wrote in my previous comment.
> > > 
> > > 
> > > Ok I got the initial state error now (so I should be able to fix it with bashonly fix But I still got a question. Since I can still generate a cookie.txt file from a real browser (a webview that use edge)... how can I use that file instead of the one generated by yt-dlp or from a supported browser? In previous version yt-dlp did not generate a cookie.txt file when I used --cookie it just readed my file... now it will ovverride it... I think my own cookie file should work file. Do you know if there is any way to use it?
> > 
> > 
> > Because CR limit cookies to 30 minutes you'll have to generate cookies.txt whatever you want to use yt-dlp. It's an extra step doing that way. Just leave Firefox logged at your account and open CR site when you want to use yt-dlp. If you have a script that calls yt-dlp, add a line to open firefox on CR site and that's it.
> 
> I don't need to... My interface just extract a cookies.txt file pressing a button from my webview and it will also extract the user-agent at the same time... I made it just for me to use yt-dl (before yt-dlp). If I can still use that cookie.txt file I will... if I cannot use it anymore because there is no way to do it I will change the interface... I just want to be sure I have to change it. No way to use my own cookie.txt file?

If you want to keep changes to a minimun then add a line to open CR site at the desired browser and a wait time before geting the cookies.txt. This is what I did so solve mine (only that I use --cookies-from-browser instead)
> If you want to keep changes to a minimun then add a line to open CR site at the desired browser and a wait time before geting the cookies.txt. This is what I did so solve mine (only that I use --cookies-from-browser instead)

Like I said, that's ok if there is no way to pass my own cookies.txt file. Since I use a real browser (a webview that use edge) to make it I think it should work... but only if there is an alternative to --cookie that will not override my own file.
I don't really want to open another browser if I can avoid it.
@federicorosso1993 you can pass your own cookie file with `--cookies` option, the option's argument needs to be the path to the cookies file

but the cookies need to be exported within the last 30 minutes from a browser matching your passed `--user-agent`

> > If you want to keep changes to a minimun then add a line to open CR site at the desired browser and a wait time before geting the cookies.txt. This is what I did so solve mine (only that I use --cookies-from-browser instead)
> 
> Like I said, that's ok if there is no way to pass my own cookies.txt file. Since I use a real browser (a webview that use edge) to make it I think it should work... but only if there is an alternative to --cookie that will not override my own file. I don't really want to open another browser if I can avoid it.

Ah sorry. I don't know a way to prevent changes to cookies.txt. Afaik yt-dlp isn't supose to change that but I don't know if it actualy change it. To be sure yt-dlp won't change it you can mark the file as read only before calling yt-dlp.
@Killua-Zolldyck a proper fix is being worked on currently
> you can pass your own cookie file with `--cookies` option, the option's argument needs to be the path to the cookies file

I did it but my own file
that just start with

`# Netscape HTTP Cookie File`

get override by yt-dlp cookies file that start with

```
# Netscape HTTP Cookie File
# This file is generated by yt-dlp.  Do not edit.
```

I pass it like this
 --cookies "C:\Users\myusername\cookies.txt"
> Ah sorry. I don't know a way to prevent changes to cookies.txt. Afaik yt-dlp isn't supose to change that but I don't know if it actualy change it. To be sure yt-dlp won't change it you can mark the file as read only before calling yt-dlp.

It will actually give me this error if I try to make my cookies.txt file read only

`PermissionError: [Errno 13] Permission denied`
@federicorosso1993

> --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78'

Hmmm, your Edge browser looks a little outdated to me. My user-agent value is "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82". Be aware that this value must exactly fit the browser version, you generated the cookie with. Otherwise it will result in "403 forbidden". Looks like the browser version is part of the cookie itself and cross-checked by Crunchy. When there is a difference: forbidden...
> Hmmm, your Edge browser looks a little outdated to me. My user-agent value is "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82". Be aware that this value must exactly fit the browser version, you generated the cookie with. Otherwise it will result in "403 forbidden". Looks like the browser version is part of the cookie itself and cross-checked by Crunchy. When there is a difference: forbidden...

That's not the problem. I just set my edge browser user-agent manually that's why it's old... The problem is that yt-dlp will override the cookies.txt file that I pass as a parameter... that's why it will not match (yt-dlp use it's own cookies.txt file, with my real browser user agent, instead of using also my real cookies.txt file).
I'm still looking the code (because it's different from the yt-dl that I used before). The FAQ of yt-dlp still say that you can pass a cookies.txt file but I'm not sure when that changed because my own interface will pass username and password before cookies and user-agent so while it worked I didn't need to use the --cookies --user-agent parameter... Also for what I understand this week it was working with is own cookies.txt file (now I know that it override it... I didn't know yesterday it was doing that).
Ok maybe something is actually wrong with my own cookies.txt file... because if I use this code

 --cookies-from-browser "opera" --cookies "Path"
It will save my cookies.txt file from opera browser at the path
and if I try to use it 
--cookies "Path"
it will work...
So maybe I need to fix my own cookies.txt file.
I think I found my problem. My extractor does not get sso cookie
@federicorosso1993 the cookie you need is set by cloudflare, and iirc starts with `_cf`
> Ah so the cookie generated by yt-dlp will not work?

no, but Curl's cookies will, see https://github.com/yt-dlp/yt-dlp/issues/7442#issuecomment-1628362077
> @federicorosso1993 the cookie you need is set by cloudflare, and iirc starts with `_cf`

I already got that one... I need to add sso.crunchyroll.com (two of them) and (maybe) static.crunchyroll.com... those are missing from my original cookies.txt file. I think because I only extract cookies.txt on my current page (while the yt-dlp extractor work with all browser cookies.. but it still works even if I delete all not crunchyroll related cookies... it still get the sso cookies that where created during log in).
Ok I was able to fix it just by adding the extraction of cookies for sso.crunchyroll.com url. I know this was my own problem but I can at least confirm for everybody that it still works by passing a correct cookies.txt file manually (it will still override the file but it will just add the comment `# This file is generated by yt-dlp.  Do not edit.` the file stay the same as the one passed manually). It just need crunchyroll.com cookies and sso.crunchyroll.com cookies
![image](https://github.com/yt-dlp/yt-dlp/assets/45123500/98653394-73dc-444c-8a9e-60ecc5570a46)
Now it gives this error, I've already tried with cookies.txt, from browser, and nothing works. Here the error seems to be unrelated to cookies, it seems that yt-dlp can't access CR

![image](https://github.com/yt-dlp/yt-dlp/assets/45123500/6ea81305-459e-4e01-b5d0-1ee3a48de6e1)
It shows more errors when I try to download the audio and video.
> ![image](https://user-images.githubusercontent.com/45123500/254278049-98653394-73dc-444c-8a9e-60ecc5570a46.png) Now it gives this error, I've already tried with cookies.txt, from browser, and nothing works. Here the error seems to be unrelated to cookies, it seems that yt-dlp can't access CR

I tried it again but for me it is still working
try like this
.\yt-dlp.exe URL --username "user" --password "pass" --write-subs --sub-langs "pt-BR" --prefer-ffmpeg --no-check-certificate - --cookies-from-browser "firefox" --user-agent 'useragent' --verbose

(try to also log out/log in again into your browser).

for the initial state error use bashonly fix
F:\[01]\FUNi>yt-dlp.exe -a "URLs.txt" --username "xxxxxxxxx" --password "xxxxxxxxx" --write-subs --sub-langs "pt-BR" --prefer-ffmpeg --no-check-certificate --cookies-from-browser "firefox" --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0" --verbose
[debug] Command-line config: ['-a', 'URLs.txt', '--username', 'PRIVATE', '--password', 'PRIVATE', '--write-subs', '--sub-langs', 'pt-BR', '--prefer-ffmpeg', '--no-check-certificate', '--cookies-from-browser', 'firefox', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0', '--verbose']
[debug] Batch file urls: ['https://www.crunchyroll.com/pt-br/watch/G4VUQ10V8/yuuya-and-kaori']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 6.0-full_build-www.gyan.dev (setts), ffprobe 6.0-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[Cookies] Extracting cookies from firefox
[debug] Extracting cookies from: "C:\Users\r2sce\AppData\Roaming\Mozilla\Firefox\Profiles\1919np28.default-release\cookies.sqlite"
[Cookies] Extracted 46 cookies from firefox
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[crunchyroll] Extracting URL: https://www.crunchyroll.com/pt-br/watch/G4VUQ10V8/yuuya-and-kaori
[crunchyroll] Retrieving main page (lang=pt-br/)
ERROR: [crunchyroll] G4VUQ10V8: Unable to extract initial state; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 710, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 99, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 72, in _update_query
  File "yt_dlp\extractor\common.py", line 1272, in _search_json
  File "yt_dlp\extractor\common.py", line 1258, in _search_regex


F:\[01]\FUNi>pause
-----------------------------------------------------
It gave the same error; it must be the extractor 🤔
As Federico already said: "for the initial state error use bashonly fix" and compile yourself of course.

Or wait fior the next yt-dlp version which will include the fix.

Fixes for both the 403 and the initial state have been worked on in #7632, but they need testing.

A pre-release build is available: https://github.com/yt-dlp/yt-dlp/pull/7632#issuecomment-1641074939.
Please test it and see if the fixes worked for you.
with edge 
![image](https://github.com/yt-dlp/yt-dlp/assets/45123500/71f8f6ef-3be3-4e66-84b4-0b723d8f836b)

with firefox 
![image](https://github.com/yt-dlp/yt-dlp/assets/45123500/2e796e97-a028-40ac-bc52-d0991860482a)
So I tried it the way I used to before, and it still gave an error.
And I refreshed the Crunchyroll page, also logged out and logged back in, and it didn't work 🤔
> So I tried it the way I used to before, and it still gave an error.

@Rafawell you need to add `ua_workaround` to your crunchyrollbeta extractor-args for the "old" way to work with this build
e.g. `--extractor-args "crunchyrollbeta:format=vo_adaptive_dash;ua_workaround"`
or, if you aren't passing any other extractor args: `--extractor-args "crunchyrollbeta:ua_workaround"`
F:\[01]\FUNi>yt-dlp -v --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36" --match-filter "language=pt-BR" --extractor-args "crunchyrollbeta:format=ua_workaround" -a "URLs.txt" --cookies-from-browser edge -o "%(series)s - S%(season_number)sE%(episode_number)02d - %(episode)s" --print filename  --print urls  1>>OVER.txt
[debug] Command-line config: ['-v', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36', '--match-filter', 'language=pt-BR', '--extractor-args', 'crunchyrollbeta:format=ua_workaround', '-a', 'URLs.txt', '--cookies-from-browser', 'edge', '-o', '%(series)s - S%(season_number)sE%(episode_number)02d - %(episode)s', '--print', 'filename', '--print', 'urls']
[debug] Batch file urls: ['https://www.crunchyroll.com/pt-br/series/GEXH3W49E/i-got-a-cheat-skill-in-another-world-and-became-unrivaled-in-the-real-world-too']
Extracting cookies from edge
[debug] Extracting cookies from: "C:\Users\r2sce\AppData\Local\Microsoft\Edge\User Data\Default\Network\Cookies"
[debug] Found local state file at "C:\Users\r2sce\AppData\Local\Microsoft\Edge\User Data\Local State"
Extracted 4089 cookies from edge
[debug] cookie version breakdown: {'v10': 4089, 'other': 0, 'unencrypted': 0}
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out cp1252 (No VT), error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.18.215323 [c558917fa] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 6.0-full_build-www.gyan.dev (setts), ffprobe 6.0-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[crunchyroll:playlist] Extracting URL: https://www.crunchyroll.com/pt-br/series/GEXH3W49E/i-got-a-cheat-skill-in-another-world-and-became-unrivaled-in-the-real-world-too
[debug] [crunchyroll:playlist] Using cxApiParam=noaihdevm_6iyg0a8l0q
[crunchyroll:playlist] Authenticating with grant_type=etp_rt_cookie
ERROR: [crunchyroll:playlist] GEXH3W49E: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 715, in extract
  File "yt_dlp\extractor\crunchyroll.py", line 500, in _real_extract
  File "yt_dlp\extractor\crunchyroll.py", line 138, in _call_api
  File "yt_dlp\extractor\crunchyroll.py", line 119, in _call_base_api
  File "yt_dlp\extractor\crunchyroll.py", line 98, in _update_auth
  File "yt_dlp\extractor\common.py", line 1069, in download_content
  File "yt_dlp\extractor\common.py", line 1033, in download_handle
  File "yt_dlp\extractor\common.py", line 903, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 860, in _request_webpage

  File "yt_dlp\networking\_urllib.py", line 432, in _send
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 4059, in urlopen
  File "yt_dlp\networking\common.py", line 89, in send
  File "yt_dlp\networking\_helper.py", line 203, in wrapper
  File "yt_dlp\networking\common.py", line 297, in send
  File "yt_dlp\networking\_urllib.py", line 437, in _send
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "yt_dlp\extractor\common.py", line 847, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 4078, in urlopen
yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 403: Forbidden


F:\[01]\FUNi>pause

I tried with the command that I used the most and it gave this error 🤔
![image](https://github.com/yt-dlp/yt-dlp/assets/45123500/878888c9-da47-4e5d-aa4e-6c5e8f1def54)

It's strange, using cookies from Edge gave an error here, but testing it now with Firefox cookies worked 🤔

#7632 is working for me using "--extractor-arg crunchyrollbeta:ua_workaround" option. Thanks a lot!
#7632 does not solve the 403 after 30min error, i still need to refresh the CR homepage to get the newest cookie. And username and password login still broken.
> i still need to refresh the CR homepage to get the newest cookie

It's an incredibly ugly solution, but I added a line to my download script to open the video in a new firefox tab if I pass a crunchyroll link into it. At least this way the download process is still automated. No need to manually refresh the page.

An add-on (e.g. Tab-Reloader) works here, which automatically reloads the start page every 15 minutes. It works really well here.
Since the 403 workaround didn't work I have merged the initial state fix for now. If someone else has any other idea please let us know. Otherwise we will have to wait for curl-impersonate.
Relevant: https://github.com/yt-dlp/yt-dlp/issues/7442#issuecomment-1636627709

PS: I've hidden all previous discussion and left only the comments needed to understand the current situation. This is so people (incl myself) can get up to speed quickly. If your comment has been hidden, don't take it personally.
> YT_DLP_CCI_IMPERSONATE=chrome110 yt-dlp -v URL
```
$env:YT_DLP_CCI_IMPERSONATE="chrome110"
[debug] Command-line config: ['-R', 'infinite', '-v', '--force-overwrites', '--fragment-retries', 'infinite', '--no-mtime', '-u', 'PRIVATE', '-p', 'PRIVATE', '-N', '16', '--embed-subs', '--sub-langs', 'all', 'https://www.crunchyroll.com/link-click/episode-3-untitled-905875', '-o', '1.mkv']
[debug] Encodings: locale cp936, fs utf-8, pref cp936, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (source)
[debug] Lazy loading extractors is disabled
[debug] Git HEAD: cba916d1f
[debug] Python 3.9.1 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1g  21 Apr 2020)
[debug] exe versions: ffmpeg N-108083-g06b98e396a-20220909 (setts), ffprobe N-108083-g06b98e396a-20220909
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Loaded 1855 extractors
[generic] Extracting URL: https://www.crunchyroll.com/link-click/episode-3-untitled-905875
[generic] episode-3-untitled-905875: Downloading webpage
ERROR: Unable to handle request: Unsupported request extension: "impersonate" (urllib)
Traceback (most recent call last):
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 1578, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 1706, in __extract_info
    ie_result = ie.extract(url)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 715, in extract
    ie_result = self._real_extract(url)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\generic.py", line 2430, in _real_extract
    full_response = self._request_webpage(url, video_id, headers={
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 847, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 4048, in urlopen
    return self._request_director.send(req)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\director.py", line 128, in send
    raise NoSupportingHandlers(unsupported_errors, unexpected_errors)
yt_dlp.networking.exceptions.NoSupportingHandlers: Unable to handle request: Unsupported request extension: "impersonate" (urllib)
```
@BraveSail Pls do `pip install curl_cffi` and try again
> @BraveSail Pls do `pip install curl_cffi` and try again

It works with login method, but `--cookies-from-browser` show's 400 error, anyway it fix the 403 error, seems has solved the main issue. 

EDIT: the` -u -p --cookies cookie.txt` works normally too.

```
[debug] Command-line config: ['-R', 'infinite', '-v', '--force-overwrites', '--fragment-retries', 'infinite', '--no-mtime', '--cookies-from-browser', 'brave', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36', '-N', '16', '--embed-subs', '--sub-langs', 'all', 'https://www.crunchyroll.com/link-click/episode-3-untitled-905875', '-o', '1.mkv']
Extracting cookies from brave
[debug] Extracting cookies from: "C:\Users\*\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Network\Cookies"
[debug] Found local state file at "C:\Users\*\AppData\Local\BraveSoftware\Brave-Browser\User Data\Local State"
Extracted 1771 cookies from brave
[debug] cookie version breakdown: {'v10': 1771, 'other': 0, 'unencrypted': 0}
[debug] Encodings: locale cp936, fs utf-8, pref cp936, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (source)
[debug] Lazy loading extractors is disabled
[debug] Git HEAD: cba916d1f
[debug] Python 3.9.1 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1g  21 Apr 2020)
[debug] exe versions: ffmpeg N-108083-g06b98e396a-20220909 (setts), ffprobe N-108083-g06b98e396a-20220909
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, curl_cffi-None, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] Request Handlers: curl_cffi, urllib
[debug] Loaded 1855 extractors
[generic] Extracting URL: https://www.crunchyroll.com/link-click/episode-3-untitled-905875
[generic] episode-3-untitled-905875: Downloading webpage
[redirect] Following redirect to https://www.crunchyroll.com/watch/G9DUE5NQE/untitled
[crunchyroll] Extracting URL: https://www.crunchyroll.com/watch/G9DUE5NQE/untitled
[crunchyroll] Retrieving main page (lang=None)
[debug] [crunchyroll] Using cxApiParam=noaihdevm_6iyg0a8l0q
[crunchyroll] Authenticating with grant_type=etp_rt_cookie
ERROR: [crunchyroll] G9DUE5NQE: Unable to download JSON metadata: HTTP Error 400: Bad Request (caused by <HTTPError 400: Bad Request>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 715, in extract
    ie_result = self._real_extract(url)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
    response = traverse_obj(self._call_api(
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
    result = self._call_base_api(
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 100, in _call_base_api
    self._update_auth()
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 91, in _update_auth
    auth_response = self._download_json(
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 1069, in download_content
    res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 1033, in download_handle
    res = self._download_webpage_handle(
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 903, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 860, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 4048, in urlopen
    return self._request_director.send(req)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\director.py", line 115, in send
    response = handler.send(request)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\common.py", line 47, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\common.py", line 237, in send
    return self._send(request)
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\_curlcffi.py", line 204, in _send
    raise HTTPError(response, redirect_loop=max_redirects_exceeded)
yt_dlp.networking.exceptions.HTTPError: HTTP Error 400: Bad Request

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 847, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
  File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 4067, in urlopen
    raise _CompatHTTPError(e) from e
yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 400: Bad Request
```
> > @BraveSail Pls do `pip install curl_cffi` and try again
> 
> It works with login method, but `--cookies-from-browser` show's 400 error, anyway it fix the 403 error, seems has solved the main issue.
> 
> EDIT: the` -u -p --cookies cookie.txt` works normally too.
> 
> ```
> [debug] Command-line config: ['-R', 'infinite', '-v', '--force-overwrites', '--fragment-retries', 'infinite', '--no-mtime', '--cookies-from-browser', 'brave', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36', '-N', '16', '--embed-subs', '--sub-langs', 'all', 'https://www.crunchyroll.com/link-click/episode-3-untitled-905875', '-o', '1.mkv']
> Extracting cookies from brave
> [debug] Extracting cookies from: "C:\Users\*\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Network\Cookies"
> [debug] Found local state file at "C:\Users\*\AppData\Local\BraveSoftware\Brave-Browser\User Data\Local State"
> Extracted 1771 cookies from brave
> [debug] cookie version breakdown: {'v10': 1771, 'other': 0, 'unencrypted': 0}
> [debug] Encodings: locale cp936, fs utf-8, pref cp936, out utf-8, error utf-8, screen utf-8
> [debug] yt-dlp version stable@2023.07.06 [b532a3481] (source)
> [debug] Lazy loading extractors is disabled
> [debug] Git HEAD: cba916d1f
> [debug] Python 3.9.1 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1g  21 Apr 2020)
> [debug] exe versions: ffmpeg N-108083-g06b98e396a-20220909 (setts), ffprobe N-108083-g06b98e396a-20220909
> [debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, curl_cffi-None, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
> [debug] Proxy map: {}
> [debug] Request Handlers: curl_cffi, urllib
> [debug] Loaded 1855 extractors
> [generic] Extracting URL: https://www.crunchyroll.com/link-click/episode-3-untitled-905875
> [generic] episode-3-untitled-905875: Downloading webpage
> [redirect] Following redirect to https://www.crunchyroll.com/watch/G9DUE5NQE/untitled
> [crunchyroll] Extracting URL: https://www.crunchyroll.com/watch/G9DUE5NQE/untitled
> [crunchyroll] Retrieving main page (lang=None)
> [debug] [crunchyroll] Using cxApiParam=noaihdevm_6iyg0a8l0q
> [crunchyroll] Authenticating with grant_type=etp_rt_cookie
> ERROR: [crunchyroll] G9DUE5NQE: Unable to download JSON metadata: HTTP Error 400: Bad Request (caused by <HTTPError 400: Bad Request>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 715, in extract
>     ie_result = self._real_extract(url)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 320, in _real_extract
>     response = traverse_obj(self._call_api(
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 114, in _call_api
>     result = self._call_base_api(
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 100, in _call_base_api
>     self._update_auth()
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\crunchyroll.py", line 91, in _update_auth
>     auth_response = self._download_json(
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 1069, in download_content
>     res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 1033, in download_handle
>     res = self._download_webpage_handle(
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 903, in _download_webpage_handle
>     urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 860, in _request_webpage
>     raise ExtractorError(errmsg, cause=err)
> 
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 4048, in urlopen
>     return self._request_director.send(req)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\director.py", line 115, in send
>     response = handler.send(request)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\common.py", line 47, in wrapper
>     return func(self, *args, **kwargs)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\common.py", line 237, in send
>     return self._send(request)
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\networking\_curlcffi.py", line 204, in _send
>     raise HTTPError(response, redirect_loop=max_redirects_exceeded)
> yt_dlp.networking.exceptions.HTTPError: HTTP Error 400: Bad Request
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\extractor\common.py", line 847, in _request_webpage
>     return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
>   File "C:\Users\*\Desktop\tools\yt-dlp\yt_dlp\YoutubeDL.py", line 4067, in urlopen
>     raise _CompatHTTPError(e) from e
> yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 400: Bad Request
> ```

Not really prof 403 is solved just that a bad request is made. So this need to be fixed to check if 403 is really solved as this error could be triggered before the 403.
> Not really prof 403 is solved just that a bad request is made. So this need to be fixed to check if 403 is really solved as this error could be triggered before the 403.

This error output is when using `--cookies-from-browser`, which means when using `-u username -p pass --cookies cookie.txt` args it works normally.

ps: My 403 triggered at `[generic] Extracting URL: `.

Found some issues in #7595 :
1. pypy with `arm64 `environment need to compile curl_cffi locally to install it. Maybe same as CPython? I'm not sure since I tested pypy first.
2. pypy can not load the curl_cffi module even it have successfully installed, CPython is ok.
3. Hidive is 403 now at `video.hidive.com` when downloading the stream segment, even though hidive is not using cloudflare. (stable version is ok)

```
[debug] Command-line config: ['-v', '-R', 'infinite', '--force-overwrites', '--fragment-retries', 'infinite', '--no-mtime', '--proxy', 'http://127.0.0.1:1080', 'https://www.hidive.com/stream/otaku-elf/s01e012', '-u', 'PRIVATE', '-p', 'PRIVATE', '-N', '16', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0', '--embed-subs', '--convert-subs', 'ass', '--sub-langs', 'all', '--remux-video', 'mkv', '-o', '/root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .mkv']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version stable@2023.07.06 [b532a3481]
[debug] Python 3.9.5 (CPython aarch64 64bit) - Linux-5.10.0-21-arm64-aarch64-with-glibc2.36 (OpenSSL 1.1.1n  15 Mar 2022, glibc 2.36)
[debug] exe versions: ffmpeg 4.3.5-0, ffprobe 4.3.5-0
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.09.24, curl_cffi-None, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {'all': 'http://127.0.0.1:1080'}
[debug] Request Handlers: curl_cffi, urllib
[debug] Loaded 1767 extractors
[HiDive] None: Downloading webpage
[HiDive] Logging in
[HiDive] Extracting URL: https://www.hidive.com/stream/otaku-elf/s01e012
[HiDive] otaku-elf/s01e012: Downloading JSON metadata
[HiDive] otaku-elf/s01e012: Downloading m3u8 information
[info] otaku-elf/s01e012: Downloading subtitles: en
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] otaku-elf/s01e012: Downloading 1 format(s): ja_br_or-8361
[info] Writing video subtitles to: /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .en.vtt
[debug] Invoking http downloader on "https://www.hidive.com/caption/vtt/259c7570ee49a3c9c25098de73f85f1c02cd4a6e/OTK_s01e012_tv_br_or_ja_en_v01.vtt"
[download] Destination: /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .en.vtt
[download] 100% of   47.17KiB in 00:00:00 at 135.04KiB/s   
[SubtitlesConvertor] Converting subtitles
[INFO] Converting: [GJ.Y] Edomae Elf - 12 (Sentai .en.vtt ...
Deleting original file /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .en.vtt (pass -k to keep)
[debug] Invoking hlsnative downloader on "https://www.hidive.com/manifest/child/259c7570ee49a3c9c25098de73f85f1c02cd4a6e/OTK_s01e012_tv_br_or_ja_xx_HLS1080p_16x9_02_v.m3u8?#="
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 147
[download] Destination: /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .mp4
WARNING: The download speed shown is only of one thread. This is a known issue
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 6 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 4 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 10 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 2 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 9 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 5 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 3 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 8 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 7 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 11 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 15 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 16 (1/inf)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 14 (1/inf)...
```
> Found some issues in #7595 :
> 
>     1. pypy with `arm64 `environment need to compile curl_cffi locally to install it. Maybe same as CPython? I'm not sure since I tested pypy first.
> 
>     2. pypy can not load the curl_cffi module even it have successfully installed, CPython is ok.
> 
>     3. Hidive is 403 now at `video.hidive.com` when downloading the stream segment, even though hidive is not using cloudflare. (stable version is ok)
> 
> 
> ```
> [debug] Command-line config: ['-v', '-R', 'infinite', '--force-overwrites', '--fragment-retries', 'infinite', '--no-mtime', '--proxy', 'http://127.0.0.1:1080', 'https://www.hidive.com/stream/otaku-elf/s01e012', '-u', 'PRIVATE', '-p', 'PRIVATE', '-N', '16', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0', '--embed-subs', '--convert-subs', 'ass', '--sub-langs', 'all', '--remux-video', 'mkv', '-o', '/root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .mkv']
> [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
> [debug] yt-dlp version stable@2023.07.06 [b532a3481]
> [debug] Python 3.9.5 (CPython aarch64 64bit) - Linux-5.10.0-21-arm64-aarch64-with-glibc2.36 (OpenSSL 1.1.1n  15 Mar 2022, glibc 2.36)
> [debug] exe versions: ffmpeg 4.3.5-0, ffprobe 4.3.5-0
> [debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.09.24, curl_cffi-None, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.3
> [debug] Proxy map: {'all': 'http://127.0.0.1:1080'}
> [debug] Request Handlers: curl_cffi, urllib
> [debug] Loaded 1767 extractors
> [HiDive] None: Downloading webpage
> [HiDive] Logging in
> [HiDive] Extracting URL: https://www.hidive.com/stream/otaku-elf/s01e012
> [HiDive] otaku-elf/s01e012: Downloading JSON metadata
> [HiDive] otaku-elf/s01e012: Downloading m3u8 information
> [info] otaku-elf/s01e012: Downloading subtitles: en
> [debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
> [debug] Default format spec: bestvideo*+bestaudio/best
> [info] otaku-elf/s01e012: Downloading 1 format(s): ja_br_or-8361
> [info] Writing video subtitles to: /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .en.vtt
> [debug] Invoking http downloader on "https://www.hidive.com/caption/vtt/259c7570ee49a3c9c25098de73f85f1c02cd4a6e/OTK_s01e012_tv_br_or_ja_en_v01.vtt"
> [download] Destination: /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .en.vtt
> [download] 100% of   47.17KiB in 00:00:00 at 135.04KiB/s   
> [SubtitlesConvertor] Converting subtitles
> [INFO] Converting: [GJ.Y] Edomae Elf - 12 (Sentai .en.vtt ...
> Deleting original file /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .en.vtt (pass -k to keep)
> [debug] Invoking hlsnative downloader on "https://www.hidive.com/manifest/child/259c7570ee49a3c9c25098de73f85f1c02cd4a6e/OTK_s01e012_tv_br_or_ja_xx_HLS1080p_16x9_02_v.m3u8?#="
> [hlsnative] Downloading m3u8 manifest
> [hlsnative] Total fragments: 147
> [download] Destination: /root/bangumi/[GJ.Y] Edomae Elf - 12 (Sentai .mp4
> WARNING: The download speed shown is only of one thread. This is a known issue
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 6 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 4 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 10 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 2 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 9 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 5 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 3 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 8 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 7 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 11 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 15 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 16 (1/inf)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 14 (1/inf)...
> ```

Right, thanks for this. I don't think curl_cffi provides builds for all systems and is probably not been tested on pypy. While we may be able to help them expand their build support, it might not be something that will work for every platform.

The underlying framework is designed so that we can add another library/way of talking to curl-impersonate if need be.
> The underlying framework is designed so that we can add another library/way of talking to curl-impersonate if need be.

Hi @coletdjnz,
so I have done

```cmd
>aria2c -l log.txt https://www.crunchyroll.com/watch/GWDU8E7DD/go-ahead-and-take-a-shower
```
and the interesting part I think  is 

![image](https://github.com/yt-dlp/yt-dlp/assets/6826732/946fd2f3-f15d-4555-aa6e-39eb5e7630c8)

As I see it now the initial request to the site to download the page natively (using python/yt-dlp), parsing for video/playlists and eventually the media is actually downloaded either internally or using an external `--downloader` . Would you consider another maybe `--requester` and just leave it there for the user? [SpankBang also works](https://gist.github.com/nindogo/c3c4b08c7f72ec0718f0ffbc7b9a12ca#file-aria2c-spankbang-md)!!
Recipes for specific issues could be maintained in the HOWTOs ... 
I'm getting an identical issue with YouTube, attempting to download a video under a shortened URL (normal `watch?v=` urls don't work), but I'm not sure if YouTube also relies on cloudflare for DDOS protection.

```
░▒▓   ~   23:20 
❯ yt-dlp --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" --cookies-from-browser firefox --verbose -x https://youtu.be/urglg3WimHA
[debug] Command-line config: ['--user-agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0', '--cookies-from-browser', 'firefox', '--verbose', '-x', 'https://youtu.be/urglg3WimHA']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (pip)
[debug] Python 3.11.3 (CPython x86_64 64bit) - Linux-6.4.8-zen1-1-zen-x86_64-with-glibc2.38 (OpenSSL 3.1.2 1 Aug 2023, glibc 2.38)
[debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[Cookies] Extracting cookies from firefox
[debug] Extracting cookies from: "/home/theocgaming/.mozilla/firefox/6auw0mx5.default-release/cookies.sqlite"
[Cookies] Extracted 591 cookies from firefox
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[youtube] Extracting URL: https://youtu.be/urglg3WimHA
[youtube] urglg3WimHA: Downloading webpage
[youtube] urglg3WimHA: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[info] urglg3WimHA: Downloading 1 format(s): 251
[debug] Invoking dashsegments downloader on "https://rr5---sn-nx5s7n76.googlevideo.com/videoplayback?expire=1692188593&ei=UWvcZKzTNt-gsfIPu-O_iAc&ip=2601%3A1c0%3Ace01%3A8330%3A%3Ab4ae&id=o-APp-ldeUYrEic8asNLYM_1wA6Vp10rXg_zeyOPcqfAQj&itag=251&source=youtube&requiressl=yes&mh=Lo&mm=31%2C29&mn=sn-nx5s7n76%2Csn-nx57ynse&ms=au%2Crdu&mv=m&mvi=5&pl=39&gcr=us&initcwndbps=2427500&spc=UWF9f90WKNMhtJZXGRv6jwoM1ImGg5fjVq7A3Ay-Mw&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=2617822&dur=151.681&lmt=1684490631987199&mt=1692166645&fvip=5&keepalive=yes&fexp=24007246%2C51000023&beids=24350017&c=ANDROID&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgRbLm-FU595jZZqmXOo4x37lEoKZ8xd0On7QG1eVoc8cCIQCmsBjSEPMOSxBCctAeu3F-EpUfrVN5HRuqWU_6GysIPw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAKXeNH0zTY0WwSJuXx52GN2ojGEkwRBmzZu3-uQsOwtqAiEAgA56WYleROFAAzNeYazb-sNwG12M9LitDQ4FcvBoZt8%3D"
[dashsegments] Total fragments: 1
[download] Destination: ＂Weird Al＂ Yankovic - Foil (Official 4K Video) [urglg3WimHA].webm
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (1/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (2/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (3/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (4/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (5/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (6/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (7/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (8/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (9/10)...
[download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (10/10)...
[download] Got error: HTTP Error 403: Forbidden. Giving up after 10 retries
  File "/home/theocgaming/.local/bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 967, in main
    _exit(*variadic(_real_main(argv)))
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 957, in _real_main
    return ydl.download(all_urls)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3369, in download
    self.__download_wrapper(self.extract_info)(
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3344, in wrapper
    res = func(*args, **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1507, in extract_info
    return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1518, in wrapper
    return func(self, *args, **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1615, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1674, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2779, in process_video_result
    self.process_info(new_info)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3247, in process_info
    success, real_download = self.dl(temp_filename, info_dict)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2970, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/dash.py", line 60, in real_download
    return self.download_and_append_fragments_multiple(*args, is_fatal=lambda idx: idx == 0)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 382, in download_and_append_fragments_multiple
    return self.download_and_append_fragments(*args[0], **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 521, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 466, in download_fragment
    for retry in RetryManager(self.params.get('fragment_retries'), error_callback):
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/utils.py", line 6141, in __iter__
    self.error_callback(self.error, self.attempt, self.retries)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 463, in error_callback
    self.report_retry(err, count, retries, frag_index, fatal)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 389, in report_retry
    RetryManager.report_retry(
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/utils.py", line 6148, in report_retry
    return error(f'{e}. Giving up after {count - 1} retries') if count > 1 else error(str(e))
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 392, in <lambda>
    error=IDENTITY if not fatal else lambda e: self.report_error(f'\r[download] Got error: {e}'),
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1015, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 944, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())

ERROR: fragment 1 not found, unable to continue
  File "/home/theocgaming/.local/bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 967, in main
    _exit(*variadic(_real_main(argv)))
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 957, in _real_main
    return ydl.download(all_urls)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3369, in download
    self.__download_wrapper(self.extract_info)(
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3344, in wrapper
    res = func(*args, **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1507, in extract_info
    return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1518, in wrapper
    return func(self, *args, **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1615, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1674, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2779, in process_video_result
    self.process_info(new_info)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3247, in process_info
    success, real_download = self.dl(temp_filename, info_dict)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2970, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/dash.py", line 60, in real_download
    return self.download_and_append_fragments_multiple(*args, is_fatal=lambda idx: idx == 0)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 382, in download_and_append_fragments_multiple
    return self.download_and_append_fragments(*args[0], **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 522, in download_and_append_fragments
    result = append_fragment(
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 486, in append_fragment
    self.report_error(f'fragment {frag_index} not found, unable to continue')
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1015, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 944, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())



░▒▓   ~   23:23 
❯
```

NOTE: The 403 errors persist through the entire output, and the video doesn't properly download.
> I'm getting an identical issue with YouTube, attempting to download a video under a shortened URL (normal `watch?v=` urls don't work), but I'm not sure if YouTube also relies on cloudflare for DDOS protection.
> 
> ```
> ░▒▓   ~   23:20 
> ❯ yt-dlp --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" --cookies-from-browser firefox --verbose -x https://youtu.be/urglg3WimHA
> [debug] Command-line config: ['--user-agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0', '--cookies-from-browser', 'firefox', '--verbose', '-x', 'https://youtu.be/urglg3WimHA']
> [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
> [debug] yt-dlp version stable@2023.03.04 [392389b7d] (pip)
> [debug] Python 3.11.3 (CPython x86_64 64bit) - Linux-6.4.8-zen1-1-zen-x86_64-with-glibc2.38 (OpenSSL 3.1.2 1 Aug 2023, glibc 2.38)
> [debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0, rtmpdump 2.4
> [debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
> [Cookies] Extracting cookies from firefox
> [debug] Extracting cookies from: "/home/theocgaming/.mozilla/firefox/6auw0mx5.default-release/cookies.sqlite"
> [Cookies] Extracted 591 cookies from firefox
> [debug] Proxy map: {}
> [debug] Loaded 1786 extractors
> [youtube] Extracting URL: https://youtu.be/urglg3WimHA
> [youtube] urglg3WimHA: Downloading webpage
> [youtube] urglg3WimHA: Downloading android player API JSON
> [debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
> [debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
> [info] urglg3WimHA: Downloading 1 format(s): 251
> [debug] Invoking dashsegments downloader on "https://rr5---sn-nx5s7n76.googlevideo.com/videoplayback?expire=1692188593&ei=UWvcZKzTNt-gsfIPu-O_iAc&ip=2601%3A1c0%3Ace01%3A8330%3A%3Ab4ae&id=o-APp-ldeUYrEic8asNLYM_1wA6Vp10rXg_zeyOPcqfAQj&itag=251&source=youtube&requiressl=yes&mh=Lo&mm=31%2C29&mn=sn-nx5s7n76%2Csn-nx57ynse&ms=au%2Crdu&mv=m&mvi=5&pl=39&gcr=us&initcwndbps=2427500&spc=UWF9f90WKNMhtJZXGRv6jwoM1ImGg5fjVq7A3Ay-Mw&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=2617822&dur=151.681&lmt=1684490631987199&mt=1692166645&fvip=5&keepalive=yes&fexp=24007246%2C51000023&beids=24350017&c=ANDROID&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgRbLm-FU595jZZqmXOo4x37lEoKZ8xd0On7QG1eVoc8cCIQCmsBjSEPMOSxBCctAeu3F-EpUfrVN5HRuqWU_6GysIPw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAKXeNH0zTY0WwSJuXx52GN2ojGEkwRBmzZu3-uQsOwtqAiEAgA56WYleROFAAzNeYazb-sNwG12M9LitDQ4FcvBoZt8%3D"
> [dashsegments] Total fragments: 1
> [download] Destination: ＂Weird Al＂ Yankovic - Foil (Official 4K Video) [urglg3WimHA].webm
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (1/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (2/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (3/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (4/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (5/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (6/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (7/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (8/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (9/10)...
> [download] Got error: HTTP Error 403: Forbidden. Retrying fragment 1 (10/10)...
> [download] Got error: HTTP Error 403: Forbidden. Giving up after 10 retries
>   File "/home/theocgaming/.local/bin/yt-dlp", line 8, in <module>
>     sys.exit(main())
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 967, in main
>     _exit(*variadic(_real_main(argv)))
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 957, in _real_main
>     return ydl.download(all_urls)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3369, in download
>     self.__download_wrapper(self.extract_info)(
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3344, in wrapper
>     res = func(*args, **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1507, in extract_info
>     return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1518, in wrapper
>     return func(self, *args, **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1615, in __extract_info
>     return self.process_ie_result(ie_result, download, extra_info)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1674, in process_ie_result
>     ie_result = self.process_video_result(ie_result, download=download)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2779, in process_video_result
>     self.process_info(new_info)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3247, in process_info
>     success, real_download = self.dl(temp_filename, info_dict)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2970, in dl
>     return fd.download(name, new_info, subtitle)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 444, in download
>     ret = self.real_download(filename, info_dict)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/dash.py", line 60, in real_download
>     return self.download_and_append_fragments_multiple(*args, is_fatal=lambda idx: idx == 0)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 382, in download_and_append_fragments_multiple
>     return self.download_and_append_fragments(*args[0], **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 521, in download_and_append_fragments
>     download_fragment(fragment, ctx)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 466, in download_fragment
>     for retry in RetryManager(self.params.get('fragment_retries'), error_callback):
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/utils.py", line 6141, in __iter__
>     self.error_callback(self.error, self.attempt, self.retries)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 463, in error_callback
>     self.report_retry(err, count, retries, frag_index, fatal)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 389, in report_retry
>     RetryManager.report_retry(
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/utils.py", line 6148, in report_retry
>     return error(f'{e}. Giving up after {count - 1} retries') if count > 1 else error(str(e))
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 392, in <lambda>
>     error=IDENTITY if not fatal else lambda e: self.report_error(f'\r[download] Got error: {e}'),
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1015, in report_error
>     self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 944, in trouble
>     tb_data = traceback.format_list(traceback.extract_stack())
> 
> ERROR: fragment 1 not found, unable to continue
>   File "/home/theocgaming/.local/bin/yt-dlp", line 8, in <module>
>     sys.exit(main())
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 967, in main
>     _exit(*variadic(_real_main(argv)))
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/__init__.py", line 957, in _real_main
>     return ydl.download(all_urls)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3369, in download
>     self.__download_wrapper(self.extract_info)(
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3344, in wrapper
>     res = func(*args, **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1507, in extract_info
>     return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1518, in wrapper
>     return func(self, *args, **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1615, in __extract_info
>     return self.process_ie_result(ie_result, download, extra_info)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1674, in process_ie_result
>     ie_result = self.process_video_result(ie_result, download=download)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2779, in process_video_result
>     self.process_info(new_info)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3247, in process_info
>     success, real_download = self.dl(temp_filename, info_dict)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2970, in dl
>     return fd.download(name, new_info, subtitle)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/common.py", line 444, in download
>     ret = self.real_download(filename, info_dict)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/dash.py", line 60, in real_download
>     return self.download_and_append_fragments_multiple(*args, is_fatal=lambda idx: idx == 0)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 382, in download_and_append_fragments_multiple
>     return self.download_and_append_fragments(*args[0], **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 522, in download_and_append_fragments
>     result = append_fragment(
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/downloader/fragment.py", line 486, in append_fragment
>     self.report_error(f'fragment {frag_index} not found, unable to continue')
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1015, in report_error
>     self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
>   File "/home/theocgaming/.local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 944, in trouble
>     tb_data = traceback.format_list(traceback.extract_stack())
> 
> 
> 
> ░▒▓   ~   23:23 
> ❯
> ```
> 
> NOTE: The 403 errors persist through the entire output, and the video doesn't properly download.

that's different. you need to update
ah, i see.
it works, time to hide replies
I'm to confused could you send here a example full comand
Hi, I'm writing a small script that makes strm files. When you call this strm, my script executes the yt-dlp command with the get-url parameter and finally redirects to the obtained url. In my case it is very useful with Jellyfin

This is the context. With Crunchyroll it's a pain, the only way to keep an unattended workflow is with the `--cookies-from-browser` parameter, but it needs a fresh cookie and needs to be reloaded with a real browser every 30 minutes, easy with the task scheduler. BUT when you create a script to kill the firefox process for example, you will get a safe mode alert and block the unattended workflow. I try powershell command CloseMainWindow, but it only works in user session, not in task scheduler. The only solution is to install an addon that closes tabs with crunchyroll.com domain every minute...

Another method to keep the new cookie unnatended and hidden from the desktop?
Thanks @coletdjnz, this version https://github.com/coletdjnz/yt-dlp-dev/releases works great i can login and download premium content without worrying about cookies expiration or changing useragent on every update i used  --impersonate chrome110, and i can confirm that its working with Firefox cookies text file (expires every 30 min)  the only problem is with chrome cookies which i think Crunchyroll give different cookies for.

EDIT: --cookies-from-browser firefox never expires and you don't need to open the browser
This was fixed some months ago... but I see that it is still not merged. Is there any problem?
In what sense was this solved?
bashonly fix + cookie and it works. At least the bashonly fix should be merged I mean with a new release... the last one was made in july.
https://github.com/yt-dlp/yt-dlp/commit/9b16762f48914de9ac914601769c76668e433325 has already been merged instead to solve the initial state removal and to hint towards the workaround.

A release is on it's way, but like said above, nightly builds can be used instead if required. Use these if required.
thank you I already compiled the working version before the nightly, I didn't know a stable release was on it's way. thanks a lot for the information.
Hi, apparently the cookie expiration are changed and login work again. (stable@2023.12.30 from yt-dlp/yt-dlp)
They seemed to have changed something recently to where I get 403'd even with cookies and useragent
[debug] Command-line config: ['--cookies-from-browser', 'firefox', '--user-agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0', '--sub-langs', 'de-DE', '--write-description', '--write-thumbnail', '--write-subs', '--progress', '--extractor-args', 'crunchyrollbeta:hardsub=de-DE', '-v', 'https://www.crunchyroll.com/de/watch/GN7UD110X/the-saints-intentions']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.04.09 from yt-dlp/yt-dlp [ff0779267] (zip)
[debug] Python 3.9.2 (CPython x86_64 64bit) - Linux-5.10.0-28-amd64-x86_64-with-glibc2.31 (OpenSSL 1.1.1w  11 Sep 2023, glibc 2.31)
[debug] exe versions: ffmpeg 4.3.6-0, ffprobe 4.3.6-0, phantomjs 2.1.1, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.9.7, certifi-2020.06.20, mutagen-1.45.1, pyxattr-0.7.2, requests-2.25.1, sqlite3-3.34.1, urllib3-1.26.5
[debug] Proxy map: {}
Extracting cookies from firefox
[debug] Extracting cookies from: "/home/xxxx/.mozilla/firefox/hcxxxx.default/cookies.sqlite"
Extracted 69 cookies from firefox
[debug] Request Handlers: urllib
[debug] Loaded 1810 extractors
[crunchyroll] Extracting URL: https://www.crunchyroll.com/de/watch/GN7UD110X/the-saints-intentions
[debug] [crunchyroll] Using cxApiParam=noaihdevm_6iyg0a8l0q
[crunchyroll] Authenticating with grant_type=etp_rt_cookie
[crunchyroll] GN7UD110X: Downloading object info JSON (cms)
[crunchyroll] GN7UD110X: Downloading stream info
ERROR: [crunchyroll] GN7UD110X: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 734, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/crunchyroll.py", line 390, in _real_extract
    result['formats'], result['subtitles'] = self._extract_stream(internal_id)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/crunchyroll.py", line 169, in _extract_stream
    stream_response = self._download_json(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1127, in download_content
    res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1087, in download_handle
    res = self._download_webpage_handle(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 954, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data,
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 903, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "/usr/local/bin/yt-dlp/yt_dlp/networking/_urllib.py", line 396, in _send
    res = opener.open(urllib_req, timeout=self._calculate_timeout(request))
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 890, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query, extensions))
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 4131, in urlopen
    return self._request_director.send(req)
  File "/usr/local/bin/yt-dlp/yt_dlp/networking/common.py", line 115, in send
    response = handler.send(request)
  File "/usr/local/bin/yt-dlp/yt_dlp/networking/_helper.py", line 208, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/networking/common.py", line 335, in send
    return self._send(request)
  File "/usr/local/bin/yt-dlp/yt_dlp/networking/_urllib.py", line 401, in _send
    raise HTTPError(UrllibResponseAdapter(e.fp), redirect_loop='redirect error' in str(e)) from e
yt_dlp.networking.exceptions.HTTPError: HTTP Error 403: Forbidden

Oke, so i am not the only one
Yes, even with cookies, user-agent, user and password, it still returns "HTTP Error 403: Forbidden".
The new 403 issue (which can’t be bypassed using cookies+user agent, or using `--impersonate chrome`) is being tracked at #9745 

Resolving patch:
diff --git a/yt_dlp/extractor/crunchyroll.py b/yt_dlp/extractor/crunchyroll.py
--- a/yt_dlp/extractor/crunchyroll.py
+++ b/yt_dlp/extractor/crunchyroll.py
@@ -53,15 +53,19 @@ def _set_auth_info(self, response):
         CrunchyrollBaseIE._AUTH_EXPIRY = time_seconds(seconds=traverse_obj(response, ('expires_in', {float_or_none}), default=300) - 10)
 
     def _request_token(self, headers, data, note='Requesting token', errnote='Failed to request token'):
-        try:  # TODO: Add impersonation support here
+        try:
             return self._download_json(
                 f'{self._BASE_URL}/auth/v1/token', None, note=note, errnote=errnote,
-                headers=headers, data=urlencode_postdata(data))
+                headers=headers, data=urlencode_postdata(data), impersonate=True)
         except ExtractorError as error:
             if not isinstance(error.cause, HTTPError) or error.cause.status != 403:
                 raise
+            if target := error.cause.response.extensions.get('impersonate'):
+                raise ExtractorError(f'Got HTTP Error 403 when using impersonate target "{target}"')
             raise ExtractorError(
-                'Request blocked by Cloudflare; navigate to Crunchyroll in your browser, '
+                'Request blocked by Cloudflare. '
+                'Install the required impersonation dependency if possible, '
+                'or else navigate to Crunchyroll in your browser, '
                 'then pass the fresh cookies (with --cookies-from-browser or --cookies) '
                 'and your browser\'s User-Agent (with --user-agent)', expected=True)
 


Test patch: