]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bigo.py
1 from .common
import InfoExtractor
2 from ..utils
import ExtractorError
, urlencode_postdata
5 class BigoIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?bigo\.tv/(?:[a-z]{2,}/)?(?P<id>[^/]+)'
9 'url': 'https://www.bigo.tv/ja/221338632',
11 'id': '6576287577575737440',
12 'title': '土よ〜💁♂️ 休憩室/REST room',
13 'thumbnail': r
're:https?://.+',
15 'uploader_id': '221338632',
20 'url': 'https://www.bigo.tv/th/Tarlerm1304',
21 'only_matching': True,
23 'url': 'https://bigo.tv/115976881',
24 'only_matching': True,
27 def _real_extract(self
, url
):
28 user_id
= self
._match
_id
(url
)
30 info_raw
= self
._download
_json
(
31 'https://ta.bigo.tv/official_website/studio/getInternalStudioInfo',
32 user_id
, data
=urlencode_postdata({'siteId': user_id}
))
34 if not isinstance(info_raw
, dict):
35 raise ExtractorError('Received invalid JSON data')
36 if info_raw
.get('code'):
38 'Bigo says: %s (code %s)' % (info_raw
.get('msg'), info_raw
.get('code')), expected
=True)
39 info
= info_raw
.get('data') or {}
41 if not info
.get('alive'):
42 raise ExtractorError('This user is offline.', expected
=True)
44 formats
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
45 info
.get('hls_src'), user_id
, 'mp4', 'm3u8')
48 'id': info
.get('roomId') or user_id
,
49 'title': info
.get('roomTopic') or info
.get('nick_name') or user_id
,
52 'thumbnail': info
.get('snapshot'),
53 'uploader': info
.get('nick_name'),
54 'uploader_id': user_id
,