]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/aljazeera.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
12 class AlJazeeraIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?P<base>\w+\.aljazeera\.\w+)/(?P<type>programs?/[^/]+|(?:feature|video|new)s)?/\d{4}/\d{1,2}/\d{1,2}/(?P<id>[^/?&#]+)'
16 'url': 'https://balkans.aljazeera.net/videos/2021/11/6/pojedini-domovi-u-sarajevu-jos-pod-vodom-mjestanima-se-dostavlja-hrana',
18 'id': '6280641530001',
20 'title': 'Pojedini domovi u Sarajevu još pod vodom, mještanima se dostavlja hrana',
21 'timestamp': 1636219149,
22 'description': 'U sarajevskim naseljima Rajlovac i Reljevo stambeni objekti, ali i industrijska postrojenja i dalje su pod vodom.',
23 'upload_date': '20211106',
26 'url': 'https://balkans.aljazeera.net/videos/2021/11/6/djokovic-usao-u-finale-mastersa-u-parizu',
28 'id': '6280654936001',
30 'title': 'Đoković ušao u finale Mastersa u Parizu',
31 'timestamp': 1636221686,
32 'description': 'Novak Đoković je u polufinalu Mastersa u Parizu nakon preokreta pobijedio Poljaka Huberta Hurkacza.',
33 'upload_date': '20211106',
36 BRIGHTCOVE_URL_RE
= r
'https?://players.brightcove.net/(?P<account>\d+)/(?P<player_id>[a-zA-Z0-9]+)_(?P<embed>[^/]+)/index.html\?videoId=(?P<id>\d+)'
38 def _real_extract(self
, url
):
39 base
, post_type
, id = self
._match
_valid
_url
(url
).groups()
41 'balkans.aljazeera.net': 'ajb',
42 'chinese.aljazeera.net': 'chinese',
43 'mubasher.aljazeera.net': 'ajm',
48 'programs': 'episode',
51 }[post_type
.split('/')[0]]
52 video
= self
._download
_json
(
53 f
'https://{base}/graphql', id, query
={
55 'operationName': 'ArchipelagoSingleArticleQuery',
56 'variables': json
.dumps({
58 'postType': post_type
,
63 video
= try_get(video
, lambda x
: x
['data']['article']['video']) or {}
64 video_id
= video
.get('id')
65 account
= video
.get('accountId') or '911432371001'
66 player_id
= video
.get('playerId') or 'csvTfAlKW'
70 webpage
= self
._download
_webpage
(url
, id)
72 account
, player_id
, embed
, video_id
= self
._search
_regex
(self
.BRIGHTCOVE_URL_RE
, webpage
, 'video id',
73 group
=(1, 2, 3, 4), default
=(None, None, None, None))
77 '_type': 'url_transparent',
83 '_type': 'url_transparent',
84 'url': f
'https://players.brightcove.net/{account}/{player_id}_{embed}/index.html?videoId={video_id}',
85 'ie_key': 'BrightcoveNew'