1 from .common
import InfoExtractor
4 compat_urllib_parse_unquote
,
6 from ..utils
import int_or_none
9 class MangomoloBaseIE(InfoExtractor
):
10 _BASE_REGEX
= r
'https?://(?:admin\.mangomolo\.com/analytics/index\.php/customers/embed/|player\.mangomolo\.com/v1/)'
12 def _get_real_id(self
, page_id
):
15 def _real_extract(self
, url
):
16 page_id
= self
._get
_real
_id
(self
._match
_id
(url
))
17 webpage
= self
._download
_webpage
(
18 'https://player.mangomolo.com/v1/%s?%s' % (self
._TYPE
, url
.split('?')[1]), page_id
)
19 hidden_inputs
= self
._hidden
_inputs
(webpage
)
20 m3u8_entry_protocol
= 'm3u8' if self
._IS
_LIVE
else 'm3u8_native'
22 format_url
= self
._html
_search
_regex
(
24 r
'(?:file|src)\s*:\s*"(https?://[^"]+?/playlist\.m3u8)',
25 r
'<a[^>]+href="(rtsp://[^"]+)"'
26 ], webpage
, 'format url')
27 formats
= self
._extract
_wowza
_formats
(
28 format_url
, page_id
, m3u8_entry_protocol
, ['smil'])
29 self
._sort
_formats
(formats
)
34 'uploader_id': hidden_inputs
.get('userid'),
35 'duration': int_or_none(hidden_inputs
.get('duration')),
36 'is_live': self
._IS
_LIVE
,
41 class MangomoloVideoIE(MangomoloBaseIE
):
43 IE_NAME
= 'mangomolo:' + _TYPE
44 _VALID_URL
= MangomoloBaseIE
._BASE
_REGEX
+ r
'video\?.*?\bid=(?P<id>\d+)'
48 class MangomoloLiveIE(MangomoloBaseIE
):
50 IE_NAME
= 'mangomolo:' + _TYPE
51 _VALID_URL
= MangomoloBaseIE
._BASE
_REGEX
+ r
'(live|index)\?.*?\bchannelid=(?P<id>(?:[A-Za-z0-9+/=]|%2B|%2F|%3D)+)'
54 def _get_real_id(self
, page_id
):
55 return compat_b64decode(compat_urllib_parse_unquote(page_id
)).decode()