]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/defense.py
[ie/box] Fix formats extraction (#8649)
[yt-dlp.git] / yt_dlp / extractor / defense.py
CommitLineData
52afe996
PR
1from .common import InfoExtractor
2
3
4class DefenseGouvFrIE(InfoExtractor):
0dc13f4c 5 IE_NAME = 'defense.gouv.fr'
5886b38d 6 _VALID_URL = r'https?://.*?\.defense\.gouv\.fr/layout/set/ligthboxvideo/base-de-medias/webtv/(?P<id>[^/?#]*)'
52afe996
PR
7
8 _TEST = {
f577e0ce 9 'url': 'http://www.defense.gouv.fr/layout/set/ligthboxvideo/base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1',
f577e0ce 10 'md5': '75bba6124da7e63d2d60b5244ec9430c',
2886be15
PH
11 'info_dict': {
12 'id': '11213',
13 'ext': 'mp4',
14 'title': 'attaque-chimique-syrienne-du-21-aout-2013-1'
025171c4 15 }
52afe996
PR
16 }
17
18 def _real_extract(self, url):
2886be15 19 title = self._match_id(url)
52afe996 20 webpage = self._download_webpage(url, title)
2886be15 21
52afe996
PR
22 video_id = self._search_regex(
23 r"flashvars.pvg_id=\"(\d+)\";",
24 webpage, 'ID')
5f6a1245 25
8fb3ac36
PH
26 json_url = (
27 'http://static.videos.gouv.fr/brightcovehub/export/json/%s' %
28 video_id)
2886be15
PH
29 info = self._download_json(json_url, title, 'Downloading JSON config')
30 video_url = info['renditions'][0]['url']
31
32 return {
33 'id': video_id,
34 'ext': 'mp4',
35 'url': video_url,
36 'title': title,
37 }