Repository: yt-dlp/yt-dlp

Issue:
[crunchyroll] Music videos with too short id are not downloadable
### 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)
- [ ] 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

Germany

### Provide a description that is worded well enough to be understood

Not all music videos on Crunchyroll have a 10 char wide id, thus the exctractor fails to download e.g. https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79/egaono-hana . The following patch fixes the issue for me.

```diff
--- yt_dlp/extractor/crunchyroll.py	2023-06-25 17:38:29
+++ yt_dlp/extractor/crunchyroll.py	2023-06-25 09:20:45
@@ -490,7 +490,7 @@
     _VALID_URL = r'''(?x)
         https?://(?:www\.)?crunchyroll\.com/
         (?P<lang>(?:\w{2}(?:-\w{2})?/)?)
-        watch/(?P<type>concert|musicvideo)/(?P<id>\w{10})'''
+        watch/(?P<type>concert|musicvideo)/(?P<id>\w+)'''
     _TESTS = [{
         'url': 'https://www.crunchyroll.com/watch/musicvideo/MV88BB7F2C',
         'info_dict': {
```


### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] 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
[debug] Command-line config: ['-vU', '--cookies-from-browser', 'firefox', 'https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79/egaono-hana']
[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.06.22 [812cdfa06]
[debug] Lazy loading extractors is disabled
[debug] Python 3.9.6 (CPython arm64 64bit) - macOS-13.4.1-arm64-arm-64bit (LibreSSL 2.8.3)
[debug] exe versions: ffmpeg 4.4.4 (fdk,setts), ffprobe 4.4.4, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15.2, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[Cookies] Extracting cookies from firefox
[debug] Extracting cookies from: "/Users/pundt/Library/Application Support/Firefox/Profiles/vqmzrywf.default/cookies.sqlite"
[Cookies] Extracted 1984 cookies from firefox
[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
yt-dlp is up to date (stable@2023.06.22)
[generic] Extracting URL: https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79/egaono-hana
[generic] egaono-hana: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] egaono-hana: Extracting information
[debug] Looking for embeds
ERROR: Unsupported URL: https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79/egaono-hana
Traceback (most recent call last):
  File "/Library/Python/3.9/site-packages/yt_dlp/YoutubeDL.py", line 1555, in wrapper
    return func(self, *args, **kwargs)
  File "/Library/Python/3.9/site-packages/yt_dlp/YoutubeDL.py", line 1631, in __extract_info
    ie_result = ie.extract(url)
  File "/Library/Python/3.9/site-packages/yt_dlp/extractor/common.py", line 708, in extract
    ie_result = self._real_extract(url)
  File "/Library/Python/3.9/site-packages/yt_dlp/extractor/generic.py", line 2568, in _real_extract
    raise UnsupportedError(url)
yt_dlp.utils.UnsupportedError: Unsupported URL: https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79/egaono-hana
```



Discussion:
Can I work on this ?


ofc. Make sure to add a test
@pukkandan I have identified some changes that I believe will help resolve the issue. Could you please guide me on the easiest way to compile this code on my local machine? I would like to make the necessary modifications and test them effectively
wdym? This is python. You just run it...
@pukkandan My apologies  got bit confused with  the contributing guide. Based on your explanation, it seems that the change in the regex pattern can indeed solve the issue. Is this approach the correct one, or do you want  to implement it in a different way ?
Yes, if the patch works, just use that and add/improve tests.
@pukkandan What I am thinking is that providing one link of a video with a 10-character id and another with fewer than 10 characters would be sufficient for the test. Now that the regex has no limit, it is more universal and will work with all videos, whereas previously it was limited to 10 characters
The regex I used in the patch for the class CrunchyrollMusicIE corresponds exactly to the URL's that are excluded by class CrunchyrollBetaIE, therefore we should stick with that. 

The regex is simply a gateway to find the right exctractor. There's no need to further limit the regex, because Crunchyroll will tell us anyway, when the URL is wrong. Adding a test for a valid 9 char id should be enough for this issue.
@rdamas yes yes  you are right so are you making a PR or should I make a one ?
You have volunteered to, so go ahead.
@rdamas Grateful ! Thanks 
Will publish a PR as I get the information about the test cases 
> Adding a test for a valid 9 char id should be enough for this issue.

@AmanSal1 rdamas is correct, this ^^ is sufficient
@bashonly I have added one of the test case containing 9 character id. Making a PR


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
@@ -490,8 +490,21 @@ class CrunchyrollMusicIE(CrunchyrollBaseIE):
     _VALID_URL = r'''(?x)
         https?://(?:www\.)?crunchyroll\.com/
         (?P<lang>(?:\w{2}(?:-\w{2})?/)?)
-        watch/(?P<type>concert|musicvideo)/(?P<id>\w{10})'''
+        watch/(?P<type>concert|musicvideo)/(?P<id>\w+)'''
     _TESTS = [{
+        'url': 'https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79',
+        'info_dict': {
+            'ext': 'mp4',
+            'id': 'MV5B02C79',
+            'display_id': 'egaono-hana',
+            'title': 'Egaono Hana',
+            'track': 'Egaono Hana',
+            'artist': 'Goose house',
+            'thumbnail': r're:(?i)^https://www.crunchyroll.com/imgsrv/.*\.jpeg?$',
+            'genre': ['J-Pop'],
+        },
+        'params': {'skip_download': 'm3u8'},
+    }, {
         'url': 'https://www.crunchyroll.com/watch/musicvideo/MV88BB7F2C',
         'info_dict': {
             'ext': 'mp4',
@@ -519,11 +532,14 @@ class CrunchyrollMusicIE(CrunchyrollBaseIE):
         },
         'params': {'skip_download': 'm3u8'},
     }, {
-        'url': 'https://www.crunchyroll.com/watch/musicvideo/MV88BB7F2C/crossing-field',
+        'url': 'https://www.crunchyroll.com/de/watch/musicvideo/MV5B02C79/egaono-hana',
         'only_matching': True,
     }, {
         'url': 'https://www.crunchyroll.com/watch/concert/MC2E2AC135/live-is-smile-always-364joker-at-yokohama-arena',
         'only_matching': True,
+    }, {
+        'url': 'https://www.crunchyroll.com/watch/musicvideo/MV88BB7F2C/crossing-field',
+        'only_matching': True,
     }]
     _API_ENDPOINT = 'music'
 


Test patch: