]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/aljazeera.py
93f95dd46555809d85033b3769c2764378da9b88
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class AlJazeeraIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?aljazeera\.com/(?P<type>program/[^/]+|(?:feature|video)s)/\d{4}/\d{1,2}/\d{1,2}/(?P<id>[^/?&#]+)'
12 'url': 'https://www.aljazeera.com/program/episode/2014/9/19/deliverance',
14 'id': '3792260579001',
16 'title': 'The Slum - Episode 1: Deliverance',
17 'description': 'As a birth attendant advocating for family planning, Remy is on the frontline of Tondo\'s battle with overcrowding.',
18 'uploader_id': '665003303001',
19 'timestamp': 1411116829,
20 'upload_date': '20140919',
22 'add_ie': ['BrightcoveNew'],
23 'skip': 'Not accessible from Travis CI server',
25 'url': 'https://www.aljazeera.com/videos/2017/5/11/sierra-leone-709-carat-diamond-to-be-auctioned-off',
26 'only_matching': True,
28 'url': 'https://www.aljazeera.com/features/2017/8/21/transforming-pakistans-buses-into-art',
29 'only_matching': True,
31 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
33 def _real_extract(self
, url
):
34 post_type
, name
= self
._match
_valid
_url
(url
).groups()
39 }[post_type
.split('/')[0]]
40 video
= self
._download
_json
(
41 'https://www.aljazeera.com/graphql', name
, query
={
42 'operationName': 'SingleArticleQuery',
43 'variables': json
.dumps({
45 'postType': post_type
,
49 })['data']['article']['video']
50 video_id
= video
['id']
51 account_id
= video
.get('accountId') or '665003303001'
52 player_id
= video
.get('playerId') or 'BkeSH5BDb'
53 return self
.url_result(
54 self
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, video_id
),
55 'BrightcoveNew', video_id
)