You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

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