]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/defense.py
7d73ea862e725a827cccbade70e6be7383656920
[yt-dlp.git] / yt_dlp / extractor / defense.py
1 from .common import InfoExtractor
2
3
4 class DefenseGouvFrIE(InfoExtractor):
5 IE_NAME = 'defense.gouv.fr'
6 _VALID_URL = r'https?://.*?\.defense\.gouv\.fr/layout/set/ligthboxvideo/base-de-medias/webtv/(?P<id>[^/?#]*)'
7
8 _TEST = {
9 'url': 'http://www.defense.gouv.fr/layout/set/ligthboxvideo/base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1',
10 'md5': '75bba6124da7e63d2d60b5244ec9430c',
11 'info_dict': {
12 'id': '11213',
13 'ext': 'mp4',
14 'title': 'attaque-chimique-syrienne-du-21-aout-2013-1'
15 }
16 }
17
18 def _real_extract(self, url):
19 title = self._match_id(url)
20 webpage = self._download_webpage(url, title)
21
22 video_id = self._search_regex(
23 r"flashvars.pvg_id=\"(\d+)\";",
24 webpage, 'ID')
25
26 json_url = (
27 'http://static.videos.gouv.fr/brightcovehub/export/json/%s' %
28 video_id)
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 }