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.

33 lines
1.5 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class AlJazeeraIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?aljazeera\.com/(?:programmes|video)/.*?/(?P<id>[^/]+)\.html'
  5. _TESTS = [{
  6. 'url': 'http://www.aljazeera.com/programmes/the-slum/2014/08/deliverance-201482883754237240.html',
  7. 'info_dict': {
  8. 'id': '3792260579001',
  9. 'ext': 'mp4',
  10. 'title': 'The Slum - Episode 1: Deliverance',
  11. 'description': 'As a birth attendant advocating for family planning, Remy is on the frontline of Tondo\'s battle with overcrowding.',
  12. 'uploader_id': '665003303001',
  13. 'timestamp': 1411116829,
  14. 'upload_date': '20140919',
  15. },
  16. 'add_ie': ['BrightcoveNew'],
  17. 'skip': 'Not accessible from Travis CI server',
  18. }, {
  19. 'url': 'http://www.aljazeera.com/video/news/2017/05/sierra-leone-709-carat-diamond-auctioned-170511100111930.html',
  20. 'only_matching': True,
  21. }]
  22. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/665003303001/default_default/index.html?videoId=%s'
  23. def _real_extract(self, url):
  24. program_name = self._match_id(url)
  25. webpage = self._download_webpage(url, program_name)
  26. brightcove_id = self._search_regex(
  27. r'RenderPagesVideo\(\'(.+?)\'', webpage, 'brightcove id')
  28. return self.url_result(self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id)