]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/bigo.py
Allow extractors to specify section_start/end for clips
[yt-dlp.git] / yt_dlp / extractor / bigo.py
index f90bfcd8e34f94586171be6e5bdfd55ba10e5d7f..f39e15002e5d28039beb50cfa3a6f41dc738dda6 100644 (file)
@@ -1,8 +1,5 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
-from ..utils import ExtractorError
+from ..utils import ExtractorError, urlencode_postdata
 
 
 class BigoIE(InfoExtractor):
@@ -32,11 +29,13 @@ def _real_extract(self, url):
 
         info_raw = self._download_json(
             'https://bigo.tv/studio/getInternalStudioInfo',
-            user_id, form_params={'siteId': user_id})
+            user_id, data=urlencode_postdata({'siteId': user_id}))
 
+        if not isinstance(info_raw, dict):
+            raise ExtractorError('Received invalid JSON data')
         if info_raw.get('code'):
             raise ExtractorError(
-                f'{info_raw["msg"]} (code {info_raw["code"]})', expected=True)
+                'Bigo says: %s (code %s)' % (info_raw.get('msg'), info_raw.get('code')), expected=True)
         info = info_raw.get('data') or {}
 
         if not info.get('alive'):
@@ -44,7 +43,7 @@ def _real_extract(self, url):
 
         return {
             'id': info.get('roomId') or user_id,
-            'title': info.get('roomTopic'),
+            'title': info.get('roomTopic') or info.get('nick_name') or user_id,
             'formats': [{
                 'url': info.get('hls_src'),
                 'ext': 'mp4',