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.

45 lines
1.7 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .brightcove import BrightcoveLegacyIE
  5. from ..compat import (
  6. compat_parse_qs,
  7. compat_urlparse,
  8. )
  9. class RMCDecouverteIE(InfoExtractor):
  10. _VALID_URL = r'https?://rmcdecouverte\.bfmtv\.com/mediaplayer-replay.*?\bid=(?P<id>\d+)'
  11. _TEST = {
  12. 'url': 'http://rmcdecouverte.bfmtv.com/mediaplayer-replay/?id=13502&title=AQUAMEN:LES%20ROIS%20DES%20AQUARIUMS%20:UN%20DELICIEUX%20PROJET',
  13. 'info_dict': {
  14. 'id': '5419055995001',
  15. 'ext': 'mp4',
  16. 'title': 'UN DELICIEUX PROJET',
  17. 'description': 'md5:63610df7c8b1fc1698acd4d0d90ba8b5',
  18. 'uploader_id': '1969646226001',
  19. 'upload_date': '20170502',
  20. 'timestamp': 1493745308,
  21. },
  22. 'params': {
  23. 'skip_download': True,
  24. },
  25. 'skip': 'only available for a week',
  26. }
  27. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1969646226001/default_default/index.html?videoId=%s'
  28. def _real_extract(self, url):
  29. video_id = self._match_id(url)
  30. webpage = self._download_webpage(url, video_id)
  31. brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage)
  32. if brightcove_legacy_url:
  33. brightcove_id = compat_parse_qs(compat_urlparse.urlparse(
  34. brightcove_legacy_url).query)['@videoPlayer'][0]
  35. else:
  36. brightcove_id = self._search_regex(
  37. r'data-video-id=["\'](\d+)', webpage, 'brightcove id')
  38. return self.url_result(
  39. self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew',
  40. brightcove_id)