]> gitweb @ CieloNegro.org - youtube-dl.git/blob - youtube_dl/extractor/aljazeera.py
[youku] Better handling for Python 2/3 compatibility
[youtube-dl.git] / youtube_dl / extractor / aljazeera.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class AlJazeeraIE(InfoExtractor):
7     _VALID_URL = r'http://www\.aljazeera\.com/programmes/.*?/(?P<id>[^/]+)\.html'
8
9     _TEST = {
10         'url': 'http://www.aljazeera.com/programmes/the-slum/2014/08/deliverance-201482883754237240.html',
11         'info_dict': {
12             'id': '3792260579001',
13             'ext': 'mp4',
14             'title': 'The Slum - Episode 1: Deliverance',
15             'description': 'As a birth attendant advocating for family planning, Remy is on the frontline of Tondo\'s battle with overcrowding.',
16             'uploader': 'Al Jazeera English',
17         },
18         'add_ie': ['Brightcove'],
19     }
20
21     def _real_extract(self, url):
22         program_name = self._match_id(url)
23         webpage = self._download_webpage(url, program_name)
24         brightcove_id = self._search_regex(
25             r'RenderPagesVideo\(\'(.+?)\'', webpage, 'brightcove id')
26
27         return {
28             '_type': 'url',
29             'url': (
30                 'brightcove:'
31                 'playerKey=AQ~~%2CAAAAmtVJIFk~%2CTVGOQ5ZTwJbeMWnq5d_H4MOM57xfzApc'
32                 '&%40videoPlayer={0}'.format(brightcove_id)
33             ),
34             'ie_key': 'Brightcove',
35         }