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