3 from .common
import InfoExtractor
5 compat_urllib_parse_urlencode
,
18 class AWAANIE(InfoExtractor
):
19 _VALID_URL
= r
'https?://(?:www\.)?(?:awaan|dcndigital)\.ae/(?:#/)?show/(?P<show_id>\d+)/[^/]+(?:/(?P<id>\d+)/(?P<season_id>\d+))?'
21 def _real_extract(self
, url
):
22 show_id
, video_id
, season_id
= self
._match
_valid
_url
(url
).groups()
23 if video_id
and int(video_id
) > 0:
24 return self
.url_result(
25 'http://awaan.ae/media/%s' % video_id
, 'AWAANVideo')
26 elif season_id
and int(season_id
) > 0:
27 return self
.url_result(smuggle_url(
28 'http://awaan.ae/program/season/%s' % season_id
,
29 {'show_id': show_id}
), 'AWAANSeason')
31 return self
.url_result(
32 'http://awaan.ae/program/%s' % show_id
, 'AWAANSeason')
35 class AWAANBaseIE(InfoExtractor
):
36 def _parse_video_data(self
, video_data
, video_id
, is_live
):
37 title
= video_data
.get('title_en') or video_data
['title_ar']
38 img
= video_data
.get('img')
43 'description': video_data
.get('description_en') or video_data
.get('description_ar'),
44 'thumbnail': format_field(img
, None, 'http://admin.mangomolo.com/analytics/%s'),
45 'duration': int_or_none(video_data
.get('duration')),
46 'timestamp': parse_iso8601(video_data
.get('create_time'), ' '),
48 'uploader_id': video_data
.get('user_id'),
52 class AWAANVideoIE(AWAANBaseIE
):
53 IE_NAME
= 'awaan:video'
54 _VALID_URL
= r
'https?://(?:www\.)?(?:awaan|dcndigital)\.ae/(?:#/)?(?:video(?:/[^/]+)?|media|catchup/[^/]+/[^/]+)/(?P<id>\d+)'
56 'url': 'http://www.dcndigital.ae/#/video/%D8%B1%D8%AD%D9%84%D8%A9-%D8%A7%D9%84%D8%B9%D9%85%D8%B1-%D8%A7%D9%84%D8%AD%D9%84%D9%82%D8%A9-1/17375',
57 'md5': '5f61c33bfc7794315c671a62d43116aa',
62 'title': 'رحلة العمر : الحلقة 1',
63 'description': 'md5:0156e935d870acb8ef0a66d24070c6d6',
65 'timestamp': 1227504126,
66 'upload_date': '20081124',
70 'url': 'http://awaan.ae/video/26723981/%D8%AF%D8%A7%D8%B1-%D8%A7%D9%84%D8%B3%D9%84%D8%A7%D9%85:-%D8%AE%D9%8A%D8%B1-%D8%AF%D9%88%D8%B1-%D8%A7%D9%84%D8%A3%D9%86%D8%B5%D8%A7%D8%B1',
71 'only_matching': True,
74 def _real_extract(self
, url
):
75 video_id
= self
._match
_id
(url
)
77 video_data
= self
._download
_json
(
78 'http://admin.mangomolo.com/analytics/index.php/plus/video?id=%s' % video_id
,
79 video_id
, headers
={'Origin': 'http://awaan.ae'}
)
80 info
= self
._parse
_video
_data
(video_data
, video_id
, False)
82 embed_url
= 'http://admin.mangomolo.com/analytics/index.php/customers/embed/video?' + compat_urllib_parse_urlencode({
83 'id': video_data
['id'],
84 'user_id': video_data
['user_id'],
85 'signature': video_data
['signature'],
90 '_type': 'url_transparent',
92 'ie_key': 'MangomoloVideo',
97 class AWAANLiveIE(AWAANBaseIE
):
98 IE_NAME
= 'awaan:live'
99 _VALID_URL
= r
'https?://(?:www\.)?(?:awaan|dcndigital)\.ae/(?:#/)?live/(?P<id>\d+)'
101 'url': 'http://awaan.ae/live/6/dubai-tv',
105 'title': 're:Dubai Al Oula [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
106 'upload_date': '20150107',
107 'timestamp': 1420588800,
112 'skip_download': True,
116 def _real_extract(self
, url
):
117 channel_id
= self
._match
_id
(url
)
119 channel_data
= self
._download
_json
(
120 'http://admin.mangomolo.com/analytics/index.php/plus/getchanneldetails?channel_id=%s' % channel_id
,
121 channel_id
, headers
={'Origin': 'http://awaan.ae'}
)
122 info
= self
._parse
_video
_data
(channel_data
, channel_id
, True)
124 embed_url
= 'http://admin.mangomolo.com/analytics/index.php/customers/embed/index?' + compat_urllib_parse_urlencode({
125 'id': base64
.b64encode(channel_data
['user_id'].encode()).decode(),
126 'channelid': base64
.b64encode(channel_data
['id'].encode()).decode(),
127 'signature': channel_data
['signature'],
132 '_type': 'url_transparent',
134 'ie_key': 'MangomoloLive',
139 class AWAANSeasonIE(InfoExtractor
):
140 IE_NAME
= 'awaan:season'
141 _VALID_URL
= r
'https?://(?:www\.)?(?:awaan|dcndigital)\.ae/(?:#/)?program/(?:(?P<show_id>\d+)|season/(?P<season_id>\d+))'
143 'url': 'http://dcndigital.ae/#/program/205024/%D9%85%D8%AD%D8%A7%D8%B6%D8%B1%D8%A7%D8%AA-%D8%A7%D9%84%D8%B4%D9%8A%D8%AE-%D8%A7%D9%84%D8%B4%D8%B9%D8%B1%D8%A7%D9%88%D9%8A',
147 'title': 'محاضرات الشيخ الشعراوي',
149 'playlist_mincount': 27,
152 def _real_extract(self
, url
):
153 url
, smuggled_data
= unsmuggle_url(url
, {})
154 show_id
, season_id
= self
._match
_valid
_url
(url
).groups()
158 data
['season'] = season_id
159 show_id
= smuggled_data
.get('show_id')
161 season
= self
._download
_json
(
162 'http://admin.mangomolo.com/analytics/index.php/plus/season_info?id=%s' % season_id
,
163 season_id
, headers
={'Origin': 'http://awaan.ae'}
)
164 show_id
= season
['id']
165 data
['show_id'] = show_id
166 show
= self
._download
_json
(
167 'http://admin.mangomolo.com/analytics/index.php/plus/show',
168 show_id
, data
=urlencode_postdata(data
), headers
={
169 'Origin': 'http://awaan.ae',
170 'Content-Type': 'application/x-www-form-urlencoded'
173 season_id
= show
['default_season']
174 for season
in show
['seasons']:
175 if season
['id'] == season_id
:
176 title
= season
.get('title_en') or season
['title_ar']
179 for video
in show
['videos']:
180 video_id
= compat_str(video
['id'])
181 entries
.append(self
.url_result(
182 'http://awaan.ae/media/%s' % video_id
, 'AWAANVideo', video_id
))
184 return self
.playlist_result(entries
, season_id
, title
)