From 27fe903c511691c078942bef5ee9a05a43b15c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Wed, 9 Jun 2021 17:54:27 -0500 Subject: initial --- hypervideo_dl/extractor/defense.py | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 hypervideo_dl/extractor/defense.py (limited to 'hypervideo_dl/extractor/defense.py') diff --git a/hypervideo_dl/extractor/defense.py b/hypervideo_dl/extractor/defense.py new file mode 100644 index 0000000..9fe144e --- /dev/null +++ b/hypervideo_dl/extractor/defense.py @@ -0,0 +1,39 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class DefenseGouvFrIE(InfoExtractor): + IE_NAME = 'defense.gouv.fr' + _VALID_URL = r'https?://.*?\.defense\.gouv\.fr/layout/set/ligthboxvideo/base-de-medias/webtv/(?P[^/?#]*)' + + _TEST = { + 'url': 'http://www.defense.gouv.fr/layout/set/ligthboxvideo/base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1', + 'md5': '75bba6124da7e63d2d60b5244ec9430c', + 'info_dict': { + 'id': '11213', + 'ext': 'mp4', + 'title': 'attaque-chimique-syrienne-du-21-aout-2013-1' + } + } + + def _real_extract(self, url): + title = self._match_id(url) + webpage = self._download_webpage(url, title) + + video_id = self._search_regex( + r"flashvars.pvg_id=\"(\d+)\";", + webpage, 'ID') + + json_url = ( + 'http://static.videos.gouv.fr/brightcovehub/export/json/%s' % + video_id) + info = self._download_json(json_url, title, 'Downloading JSON config') + video_url = info['renditions'][0]['url'] + + return { + 'id': video_id, + 'ext': 'mp4', + 'url': video_url, + 'title': title, + } -- cgit v1.2.3