1 from .common
import InfoExtractor
12 class Alsace20TVBaseIE(InfoExtractor
):
13 def _extract_video(self
, video_id
, url
=None):
14 info
= self
._download
_json
(
15 f
'https://www.alsace20.tv/visionneuse/visio_v9_js.php?key={video_id}&habillage=0&mode=html',
17 title
= info
.get('titre')
20 for res
, fmt_url
in (info
.get('files') or {}).items():
22 self
._extract
_smil
_formats
(fmt_url
, video_id
, fatal
=False)
23 if '/smil:_' in fmt_url
24 else self
._extract
_mpd
_formats
(fmt_url
, video_id
, mpd_id
=res
, fatal
=False))
26 webpage
= (url
and self
._download
_webpage
(url
, video_id
, fatal
=False)) or ''
27 thumbnail
= url_or_none(dict_get(info
, ('image', 'preview')) or self
._og
_search
_thumbnail
(webpage
))
28 upload_date
= self
._search
_regex
(r
'/(\d{6})_', thumbnail
, 'upload_date', default
=None)
29 upload_date
= unified_strdate(f
'20{upload_date[:2]}-{upload_date[2:4]}-{upload_date[4:]}') if upload_date
else None
34 'description': clean_html(get_element_by_class('wysiwyg', webpage
)),
35 'upload_date': upload_date
,
36 'thumbnail': thumbnail
,
37 'duration': int_or_none(self
._og
_search
_property
('video:duration', webpage
) if webpage
else None),
38 'view_count': int_or_none(info
.get('nb_vues')),
42 class Alsace20TVIE(Alsace20TVBaseIE
):
43 _VALID_URL
= r
'https?://(?:www\.)?alsace20\.tv/(?:[\w-]+/)+[\w-]+-(?P<id>[\w]+)'
45 'url': 'https://www.alsace20.tv/VOD/Actu/JT/Votre-JT-jeudi-3-fevrier-lyNHCXpYJh.html',
49 'description': 'md5:fc0bc4a0692d3d2dba4524053de4c7b7',
50 'title': 'Votre JT du jeudi 3 février',
51 'upload_date': '20220203',
52 'thumbnail': r
're:https?://.+\.jpg',
58 def _real_extract(self
, url
):
59 video_id
= self
._match
_id
(url
)
60 return self
._extract
_video
(video_id
, url
)
63 class Alsace20TVEmbedIE(Alsace20TVBaseIE
):
64 _VALID_URL
= r
'https?://(?:www\.)?alsace20\.tv/emb/(?P<id>[\w]+)'
66 'url': 'https://www.alsace20.tv/emb/lyNHCXpYJh',
67 # 'md5': 'd91851bf9af73c0ad9b2cdf76c127fbb',
71 'title': 'Votre JT du jeudi 3 février',
72 'upload_date': '20220203',
73 'thumbnail': r
're:https?://.+\.jpg',
77 'format': 'bestvideo',
81 def _real_extract(self
, url
):
82 video_id
= self
._match
_id
(url
)
83 return self
._extract
_video
(video_id
)