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