3 from .common
import InfoExtractor
4 from ..utils
import traverse_obj
, urljoin
7 class IslamChannelIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://watch\.islamchannel\.tv/watch/(?P<id>\d+)'
10 'url': 'https://watch.islamchannel.tv/watch/38604310',
13 'title': 'Omar - Young Omar',
14 'description': 'md5:5cc7ddecef064ea7afe52eb5e0e33b55',
15 'thumbnail': r
're:https?://.+',
20 def _real_extract(self
, url
):
21 video_id
= self
._match
_id
(url
)
22 webpage
= self
._download
_webpage
(url
, video_id
)
24 thumbnail
= self
._search
_regex
(
25 r
'data-poster="([^"]+)"', webpage
, 'data poster', fatal
=False) or \
26 self
._html
_search
_meta
(('og:image', 'twitter:image'), webpage
)
29 'Token': self
._search
_regex
(r
'data-token="([^"]+)"', webpage
, 'data token'),
30 'Token-Expiry': self
._search
_regex
(r
'data-expiry="([^"]+)"', webpage
, 'data expiry'),
33 show_stream
= self
._download
_json
(
34 f
'https://v2-streams-elb.simplestreamcdn.com/api/show/stream/{video_id}', video_id
,
36 'key': self
._search
_regex
(r
'data-key="([^"]+)"', webpage
, 'data key'),
39 # TODO: show_stream['stream'] and show_stream['drm'] may contain something interesting
40 streams
= self
._download
_json
(
41 traverse_obj(show_stream
, ('response', 'tokenization', 'url')), video_id
,
43 formats
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(traverse_obj(streams
, ('Streams', 'Adaptive')), video_id
, 'mp4')
47 'title': self
._html
_search
_meta
(('og:title', 'twitter:title'), webpage
),
48 'description': self
._html
_search
_meta
(('og:description', 'twitter:description', 'description'), webpage
),
53 'url': thumbnail
.split('?')[0],
61 }] if thumbnail
else None,
65 class IslamChannelSeriesIE(InfoExtractor
):
66 _VALID_URL
= r
'https?://watch\.islamchannel\.tv/series/(?P<id>[a-f\d-]+)'
68 'url': 'https://watch.islamchannel.tv/series/a6cccef3-3ef1-11eb-bc19-06b69c2357cd',
70 'id': 'a6cccef3-3ef1-11eb-bc19-06b69c2357cd',
72 'playlist_mincount': 31,
75 def _real_extract(self
, url
):
76 pl_id
= self
._match
_id
(url
)
77 webpage
= self
._download
_webpage
(url
, pl_id
)
79 return self
.playlist_from_matches(
80 re
.finditer(r
'<a\s+href="(/watch/\d+)"[^>]+?data-video-type="show">', webpage
),
81 pl_id
, getter
=lambda x
: urljoin(url
, x
.group(1)), ie
=IslamChannelIE
)