Repository: ytdl-org/youtube-dl

Issue:
One seemingly random "Unsupported URL", while others works just fine

## Checklist

- [x] I'm reporting a broken site support
- [x] I've verified that I'm running youtube-dl version **2021.06.06**
- [x] I've checked that all provided URLs are alive and playable in a browser
- [x] I've checked that all URLs and arguments with special characters are properly quoted or escaped
- [x] I've searched the bugtracker for similar issues including closed ones


## Verbose log


```
youtube-dl -v -F  https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-F', 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/']
[debug] Encodings: locale cp65001, fs mbcs, out cp65001, pref cp65001
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.19041
[debug] exe versions: ffmpeg 4.2.3, ffprobe git-2019-12-17-bd83191
[debug] Proxy map: {}
[generic] 9999a34: Requesting header
WARNING: Falling back on generic information extractor.
[generic] 9999a34: Downloading webpage
[generic] 9999a34: Extracting information
ERROR: Unsupported URL: https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\YoutubeDL.py", line 815, in wrapper
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\YoutubeDL.py", line 836, in __extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\common.py", line 534, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\generic.py", line 3520, in _real_extract
youtube_dl.utils.UnsupportedError: Unsupported URL: https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/

```


## Description

I'm getting " Unsupported URL" for this single link. Every other url I've tried from the nhk site (https://www3.nhk.or.jp/nhkworld/), formatted exactly like this one, downloads just fine.



Discussion:
The problem URL's ID contains a non-(decimal-)digit, ie '9999 _a_ 34', which the NHK extractor doesn't expect: it looks for IDs that are either 7 decimal digits or more than 8 characters.

Perhaps NHK ran out of the 10 million decimal IDs and decided to go for hexadecimal (>256 million) or alphanumeric (>78000 million)?

Changing the `_VALID_URL` to allow `[0-9a-f]` instead of decimal digits and modifying the [code that splits 7-character IDs](https://github.com/ytdl-org/youtube-dl/blob/a8035827177d6b59aca03bd717acb6a9bdd75ada/youtube_dl/extractor/nhk.py#L26) to check for length 7 characters instead of numeric string, we get this:
```
# youtube-dl -v -F 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/'
[debug] System config: [u'--restrict-filenames', u'--prefer-ffmpeg', u'-f', u'best[height<=?1080][fps<=?60]', u'-o', u'/media/drive1/Video/%(title)s.%(ext)s']
[debug] User config: [u'-f', u'(best/bestvideo+bestaudio)[height<=?1080][fps<=?60][tbr<=?1900]']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/']
[debug] Encodings: locale ASCII, fs ASCII, out ASCII, pref ASCII
[debug] youtube-dl version 2021.06.06.1
[debug] Python version 2.7.1 (CPython) - Linux-2.6.18-7.1-7405b0-smp-with-libc0
[debug] exe versions: ffmpeg 4.1, ffprobe 4.1
[debug] Proxy map: {}
[NhkVod] 9999-a34: Downloading JSON metadata
[Piksel] nw_c_en_9999-a34: Downloading webpage
[Piksel] nw_c_en_9999-a34: Downloading JSON metadata
[Piksel] nw_c_en_9999-a34: Downloading JSON metadata
[Piksel] qfjay6cg: Downloading m3u8 information
[Piksel] qfjay6cg: Downloading SMIL file
[info] Available formats for qfjay6cg:
format code  extension  resolution note
http-1207    mp4        1280x?     1207k 
hls-1207     mp4        unknown    1207k 
http-1179    mp4        1280x720   1179k video@1053k, audio@126k, 13.29MiB
http-656     mp4        640x?       656k 
hls-656      mp4        unknown     656k 
http-641     mp4        640x360     641k video@ 515k, audio@126k, 7.24MiB
http-387     mp4        320x?       387k 
hls-387      mp4        unknown     387k 
http-378     mp4        320x180     378k video@ 252k, audio@126k, 4.29MiB (best)
#
```
Maybe @remitamine (last committer of the relevant code) can suggest what character set (`[0-9a-f]`, `[0-9a-fA-F]`, ...) should be used for the 7-character IDs?

Resolving patch:
diff --git a/youtube_dl/extractor/nhk.py b/youtube_dl/extractor/nhk.py
--- a/youtube_dl/extractor/nhk.py
+++ b/youtube_dl/extractor/nhk.py
@@ -1,3 +1,4 @@
+# coding: utf-8
 from __future__ import unicode_literals
 
 import re
@@ -23,7 +24,7 @@ def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
     def _extract_episode_info(self, url, episode=None):
         fetch_episode = episode is None
         lang, m_type, episode_id = re.match(NhkVodIE._VALID_URL, url).groups()
-        if episode_id.isdigit():
+        if len(episode_id) == 7:
             episode_id = episode_id[:4] + '-' + episode_id[4:]
 
         is_video = m_type == 'video'
@@ -84,7 +85,8 @@ def get_clean_field(key):
 
 
 class NhkVodIE(NhkBaseIE):
-    _VALID_URL = r'%s%s(?P<id>\d{7}|[^/]+?-\d{8}-[0-9a-z]+)' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
+    # the 7-character IDs can have alphabetic chars too: assume [a-z] rather than just [a-f], eg
+    _VALID_URL = r'%s%s(?P<id>[0-9a-z]{7}|[^/]+?-\d{8}-[0-9a-z]+)' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
     # Content available only for a limited period of time. Visit
     # https://www3.nhk.or.jp/nhkworld/en/ondemand/ for working samples.
     _TESTS = [{
@@ -124,6 +126,19 @@ class NhkVodIE(NhkBaseIE):
     }, {
         'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/j_art-20150903-1/',
         'only_matching': True,
+    }, {
+        # video, alphabetic character in ID #29670
+        'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/',
+        'only_matching': True,
+        'info_dict': {
+            'id': 'qfjay6cg',
+            'ext': 'mp4',
+            'title': 'DESIGN TALKS plus - Fishermen’s Finery',
+            'description': 'md5:8a8f958aaafb0d7cb59d38de53f1e448',
+            'thumbnail': r're:^https?:/(/[a-z0-9.-]+)+\.jpg\?w=1920&h=1080$',
+            'upload_date': '20210615',
+            'timestamp': 1623722008,
+        }
     }]
 
     def _real_extract(self, url):


Test patch: