Repository: ytdl-org/youtube-dl

Issue:
www.alsace20.tv site support
## Checklist

- [x] I'm reporting a new site support request
- [x] I've verified that I'm running youtube-dl version **2021.12.17**
- [x] I've checked that all provided URLs are alive and playable in a browser
- [x] I've checked that none of provided URLs violate any copyrights
- [x] I've searched the bugtracker for similar site support requests including closed ones

## Example URLs

- Single video: https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html
- Single video (embedded): https://www.alsace20.tv/emb/lyNHCXpYJh


## Description
Just testing 

```
$ youtube-dl https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html
[generic] Votre-JT-jeudi-3-fevrier-lyNHCXpYJh: Requesting header
WARNING: Falling back on generic information extractor.
[generic] Votre-JT-jeudi-3-fevrier-lyNHCXpYJh: Downloading webpage
[generic] Votre-JT-jeudi-3-fevrier-lyNHCXpYJh: Extracting information
ERROR: Unsupported URL: https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html
$ youtube-dl https://www.alsace20.tv/emb/lyNHCXpYJh
[generic] lyNHCXpYJh: Requesting header
WARNING: Falling back on generic information extractor.
[generic] lyNHCXpYJh: Downloading webpage
[generic] lyNHCXpYJh: Extracting information
ERROR: Unsupported URL: https://www.alsace20.tv/emb/lyNHCXpYJh
```

Lot of link like this in console: 

```
https://alsace20.vod-kd.com/vod/alsace20/smil:220203_JT/default.smil/segment_ctvideo_ridp0va0br985062_cs1890000_w1998644956_mpd.m4s
https://alsace20.vod-kd.com/vod/alsace20/smil:220203_JT/default.smil/segment_ctvideo_ridp0va0br985062_cs1890000_w1998644956_mpd.m4s
…
```

Thank you :)


Discussion:
So the main thing is that JSON metadata including media links is found at `https://www.alsace20.tv/visionneuse/visio_v9_js.php?key=%s&habillage=0&mode=html' % video_id`. Unfortunately some interesting additional metadata (description, duration) is only in the web page itself and not in the embed page, so these fields aren't extracted for an embed page:

Then the example page, video_id `lyNHCXpYJh`:
```
$ python -m youtube_dl -v -F 'https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html'
[debug] System config: [u'--prefer-ffmpeg']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: 734dfbb4e
[debug] Python version 2.7.17 (CPython) - Linux-4.4.0-210-generic-i686-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv 4.3, avprobe 4.3, ffmpeg 4.3, ffprobe 4.3
[debug] Proxy map: {}
[Alsace20TV] lyNHCXpYJh: Downloading JSON metadata
[Alsace20TV] lyNHCXpYJh: Downloading MPD manifest
[Alsace20TV] lyNHCXpYJh: Downloading MPD manifest
[Alsace20TV] lyNHCXpYJh: Downloading MPD manifest
[Alsace20TV] lyNHCXpYJh: Downloading webpage
[info] Available formats for lyNHCXpYJh:
format code         extension  resolution note
auto-p0aa0br64001   m4a        audio only [eng] DASH audio   64k , m4a_dash container, mp4a.40.5 (48000Hz)
low-p0aa0br64001    m4a        audio only [eng] DASH audio   64k , m4a_dash container, mp4a.40.5 (48000Hz)
med-p0aa0br64001    m4a        audio only [eng] DASH audio   64k , m4a_dash container, mp4a.40.5 (48000Hz)
auto-p0aa0br96004   m4a        audio only [eng] DASH audio   96k , m4a_dash container, mp4a.40.2 (48000Hz)
auto-p0va0br269644  mp4        480x270    DASH video  269k , mp4_dash container, avc1.42c015, 25fps, video only
low-p0va0br269644   mp4        480x270    DASH video  269k , mp4_dash container, avc1.42c015, 25fps, video only
auto-p0va0br610270  mp4        640x360    DASH video  610k , mp4_dash container, avc1.42c01e, 25fps, video only
med-p0va0br610270   mp4        640x360    DASH video  610k , mp4_dash container, avc1.42c01e, 25fps, video only
auto-p0va0br985062  mp4        1280x720   DASH video  985k , mp4_dash container, avc1.4d401f, 25fps, video only (best)
$
```
If I make a draft PR for the Alsace20TV extractors, would you be able to test them on some other pages?

> If I make a draft PR for the Alsace20TV extractors, would you be able to test them on some other pages?

yes :)

Resolving patch:
diff --git a/youtube_dl/extractor/alsace20tv.py b/youtube_dl/extractor/alsace20tv.py
new file mode 100644
--- /dev/null
+++ b/youtube_dl/extractor/alsace20tv.py
@@ -0,0 +1,89 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+    clean_html,
+    dict_get,
+    get_element_by_class,
+    int_or_none,
+    unified_strdate,
+    url_or_none,
+)
+
+
+class Alsace20TVIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?alsace20\.tv/(?:[\w-]+/)+[\w-]+-(?P<id>[\w]+)'
+    _TESTS = [{
+        'url': 'https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html',
+        # 'md5': 'd91851bf9af73c0ad9b2cdf76c127fbb',
+        'info_dict': {
+            'id': 'lyNHCXpYJh',
+            'ext': 'mp4',
+            'description': 'md5:fc0bc4a0692d3d2dba4524053de4c7b7',
+            'title': 'Votre JT du jeudi 3 février',
+            'upload_date': '20220203',
+            'thumbnail': r're:https?://.+\.jpg',
+            'duration': 1073,
+            'view_count': int,
+        },
+        'params': {
+            'format': 'bestvideo',
+        },
+    }]
+
+    def _extract_video(self, video_id, url=None):
+        info = self._download_json(
+            'https://www.alsace20.tv/visionneuse/visio_v9_js.php?key=%s&habillage=0&mode=html' % (video_id, ),
+            video_id) or {}
+        title = info['titre']
+
+        formats = []
+        for res, fmt_url in (info.get('files') or {}).items():
+            formats.extend(
+                self._extract_smil_formats(fmt_url, video_id, fatal=False)
+                if '/smil:_' in fmt_url
+                else self._extract_mpd_formats(fmt_url, video_id, mpd_id=res, fatal=False))
+        self._sort_formats(formats)
+
+        webpage = (url and self._download_webpage(url, video_id, fatal=False)) or ''
+        thumbnail = url_or_none(dict_get(info, ('image', 'preview', )) or self._og_search_thumbnail(webpage))
+        upload_date = self._search_regex(r'/(\d{6})_', thumbnail, 'upload_date', default=None)
+        upload_date = unified_strdate('20%s-%s-%s' % (upload_date[:2], upload_date[2:4], upload_date[4:])) if upload_date else None
+        return {
+            'id': video_id,
+            'title': title,
+            'formats': formats,
+            'description': clean_html(get_element_by_class('wysiwyg', webpage)),
+            'upload_date': upload_date,
+            'thumbnail': thumbnail,
+            'duration': int_or_none(self._og_search_property('video:duration', webpage) if webpage else None),
+            'view_count': int_or_none(info.get('nb_vues')),
+        }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        return self._extract_video(video_id, url)
+
+
+class Alsace20TVEmbedIE(Alsace20TVIE):
+    _VALID_URL = r'https?://(?:www\.)?alsace20\.tv/emb/(?P<id>[\w]+)'
+    _TESTS = [{
+        'url': 'https://www.alsace20.tv/emb/lyNHCXpYJh',
+        # 'md5': 'd91851bf9af73c0ad9b2cdf76c127fbb',
+        'info_dict': {
+            'id': 'lyNHCXpYJh',
+            'ext': 'mp4',
+            'title': 'Votre JT du jeudi 3 février',
+            'upload_date': '20220203',
+            'thumbnail': r're:https?://.+\.jpg',
+            'view_count': int,
+        },
+        'params': {
+            'format': 'bestvideo',
+        },
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        return self._extract_video(video_id)
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -51,6 +51,10 @@
 from .aol import AolIE
 from .allocine import AllocineIE
 from .aliexpress import AliExpressLiveIE
+from .alsace20tv import (
+    Alsace20TVIE,
+    Alsace20TVEmbedIE,
+)
 from .apa import APAIE
 from .aparat import AparatIE
 from .appleconnect import AppleConnectIE


Test patch: