1 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
13 class BongaCamsIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?P<host>(?:[^/]+\.)?bongacams\d*\.com)/(?P<id>[^/?&#]+)'
16 'url': 'https://de.bongacams.com/azumi-8',
17 'only_matching': True,
19 'url': 'https://cn.bongacams.com/azumi-8',
20 'only_matching': True,
23 def _real_extract(self
, url
):
24 mobj
= self
._match
_valid
_url
(url
)
25 host
= mobj
.group('host')
26 channel_id
= mobj
.group('id')
28 amf
= self
._download
_json
(
29 'https://%s/tools/amf.php' % host
, channel_id
,
30 data
=urlencode_postdata((
31 ('method', 'getRoomData'),
32 ('args[]', channel_id
),
34 )), headers
={'X-Requested-With': 'XMLHttpRequest'}
)
36 server_url
= amf
['localData']['videoServerUrl']
38 uploader_id
= try_get(
39 amf
, lambda x
: x
['performerData']['username'], compat_str
) or channel_id
41 amf
, lambda x
: x
['performerData']['displayName'], compat_str
)
42 like_count
= int_or_none(try_get(
43 amf
, lambda x
: x
['performerData']['loversCount']))
45 formats
= self
._extract
_m
3u8_formats
(
46 '%s/hls/stream_%s/playlist.m3u8' % (server_url
, uploader_id
),
47 channel_id
, 'mp4', m3u8_id
='hls', live
=True)
48 self
._sort
_formats
(formats
)
52 'title': self
._live
_title
(uploader
or uploader_id
),
54 'uploader_id': uploader_id
,
55 'like_count': like_count
,