1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..compat
import compat_str
14 class BongaCamsIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?P<host>(?:[^/]+\.)?bongacams\d*\.com)/(?P<id>[^/?&#]+)'
17 'url': 'https://de.bongacams.com/azumi-8',
18 'only_matching': True,
20 'url': 'https://cn.bongacams.com/azumi-8',
21 'only_matching': True,
24 def _real_extract(self
, url
):
25 mobj
= re
.match(self
._VALID
_URL
, url
)
26 host
= mobj
.group('host')
27 channel_id
= mobj
.group('id')
29 amf
= self
._download
_json
(
30 'https://%s/tools/amf.php' % host
, channel_id
,
31 data
=urlencode_postdata((
32 ('method', 'getRoomData'),
33 ('args[]', channel_id
),
35 )), headers
={'X-Requested-With': 'XMLHttpRequest'}
)
37 server_url
= amf
['localData']['videoServerUrl']
39 uploader_id
= try_get(
40 amf
, lambda x
: x
['performerData']['username'], compat_str
) or channel_id
42 amf
, lambda x
: x
['performerData']['displayName'], compat_str
)
43 like_count
= int_or_none(try_get(
44 amf
, lambda x
: x
['performerData']['loversCount']))
46 formats
= self
._extract
_m
3u8_formats
(
47 '%s/hls/stream_%s/playlist.m3u8' % (server_url
, uploader_id
),
48 channel_id
, 'mp4', m3u8_id
='hls', live
=True)
49 self
._sort
_formats
(formats
)
53 'title': self
._live
_title
(uploader
or uploader_id
),
55 'uploader_id': uploader_id
,
56 'like_count': like_count
,