prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  plugins.bigo: Unable to parse JSON
  ### Checklist
  
  - [X] This is a [plugin issue](https://streamlink.github.io/plugins.html) and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)
  - [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)
  - [X] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)
  - [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)
  
  ### Streamlink version
  
  Latest release
  
  ### Description
  
  Hello,
  
  the bigo.py is not working at the moment.
  
  It is giving a parse JSON error.
  
  Debug log is following...
  
  ### Debug log
  
  ```text
  error: Unable to parse JSON: Expecting value: line 1 column 1 (char 0) ('<!DOCTYPE html>\n<html lang="en" s ...)
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/streamlink/plugins/bigo.py`
  Content:
  ```
  1 """
  2 $description Global live streaming platform for live video game broadcasts and individual live streams.
  3 $url live.bigo.tv
  4 $url bigoweb.co
  5 $type live
  6 """
  7 
  8 import re
  9 
  10 from streamlink.plugin import Plugin, pluginmatcher
  11 from streamlink.plugin.api import useragents, validate
  12 from streamlink.stream.hls import HLSStream
  13 
  14 
  15 @pluginmatcher(re.compile(
  16     r"https?://(?:www\.)?bigo\.tv/([^/]+)$",
  17 ))
  18 class Bigo(Plugin):
  19     _api_url = "https://www.bigo.tv/OInterface/getVideoParam?bigoId={0}"
  20 
  21     _video_info_schema = validate.Schema({
  22         "code": 0,
  23         "msg": "success",
  24         "data": {
  25             "videoSrc": validate.any(None, "", validate.url()),
  26         },
  27     })
  28 
  29     def _get_streams(self):
  30         res = self.session.http.get(
  31             self._api_url.format(self.match.group(1)),
  32             allow_redirects=True,
  33             headers={"User-Agent": useragents.IPHONE_6},
  34         )
  35         data = self.session.http.json(res, schema=self._video_info_schema)
  36         videourl = data["data"]["videoSrc"]
  37         if videourl:
  38             yield "live", HLSStream(self.session, videourl)
  39 
  40 
  41 __plugin__ = Bigo
  42
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/streamlink/plugins/bigo.py b/src/streamlink/plugins/bigo.py
  --- a/src/streamlink/plugins/bigo.py
  +++ b/src/streamlink/plugins/bigo.py
  @@ -1,41 +1,68 @@
   """
  -$description Global live streaming platform for live video game broadcasts and individual live streams.
  -$url live.bigo.tv
  -$url bigoweb.co
  +$description Global live-streaming platform for live video game broadcasts and individual live streams.
  +$url bigo.tv
   $type live
  +$metadata id
  +$metadata author
  +$metadata category
  +$metadata title
   """
   
  +import logging
   import re
   
   from streamlink.plugin import Plugin, pluginmatcher
  -from streamlink.plugin.api import useragents, validate
  +from streamlink.plugin.api import validate
   from streamlink.stream.hls import HLSStream
   
   
  +log = logging.getLogger(__name__)
  +
  +
   @pluginmatcher(re.compile(
  -    r"https?://(?:www\.)?bigo\.tv/([^/]+)$",
  +    r"https?://(?:www\.)?bigo\.tv/(?P<site_id>[^/]+)$",
   ))
   class Bigo(Plugin):
  -    _api_url = "https://www.bigo.tv/OInterface/getVideoParam?bigoId={0}"
  -
  -    _video_info_schema = validate.Schema({
  -        "code": 0,
  -        "msg": "success",
  -        "data": {
  -            "videoSrc": validate.any(None, "", validate.url()),
  -        },
  -    })
  +    _URL_API = "https://ta.bigo.tv/official_website/studio/getInternalStudioInfo"
   
       def _get_streams(self):
  -        res = self.session.http.get(
  -            self._api_url.format(self.match.group(1)),
  -            allow_redirects=True,
  -            headers={"User-Agent": useragents.IPHONE_6},
  +        self.id, self.author, self.category, self.title, hls_url = self.session.http.post(
  +            self._URL_API,
  +            params={
  +                "siteId": self.match["site_id"],
  +                "verify": "",
  +            },
  +            schema=validate.Schema(
  +                validate.parse_json(),
  +                {
  +                    "code": 0,
  +                    "msg": "success",
  +                    "data": {
  +                        "roomId": validate.any(None, str),
  +                        "clientBigoId": validate.any(None, str),
  +                        "gameTitle": str,
  +                        "roomTopic": str,
  +                        "hls_src": validate.any(None, "", validate.url()),
  +                    },
  +                },
  +                validate.union_get(
  +                    ("data", "roomId"),
  +                    ("data", "clientBigoId"),
  +                    ("data", "gameTitle"),
  +                    ("data", "roomTopic"),
  +                    ("data", "hls_src"),
  +                ),
  +            ),
           )
  -        data = self.session.http.json(res, schema=self._video_info_schema)
  -        videourl = data["data"]["videoSrc"]
  -        if videourl:
  -            yield "live", HLSStream(self.session, videourl)
  +
  +        if not self.id:
  +            return
  +
  +        if not hls_url:
  +            log.info("Channel is offline")
  +            return
  +
  +        yield "live", HLSStream(self.session, hls_url)
   
   
   __plugin__ = Bigo
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/bigo.py b/src/streamlink/plugins/bigo.py\n--- a/src/streamlink/plugins/bigo.py\n+++ b/src/streamlink/plugins/bigo.py\n@@ -1,41 +1,68 @@\n \"\"\"\n-$description Global live streaming platform for live video game broadcasts and individual live streams.\n-$url live.bigo.tv\n-$url bigoweb.co\n+$description Global live-streaming platform for live video game broadcasts and individual live streams.\n+$url bigo.tv\n $type live\n+$metadata id\n+$metadata author\n+$metadata category\n+$metadata title\n \"\"\"\n \n+import logging\n import re\n \n from streamlink.plugin import Plugin, pluginmatcher\n-from streamlink.plugin.api import useragents, validate\n+from streamlink.plugin.api import validate\n from streamlink.stream.hls import HLSStream\n \n \n+log = logging.getLogger(__name__)\n+\n+\n @pluginmatcher(re.compile(\n-    r\"https?://(?:www\\.)?bigo\\.tv/([^/]+)$\",\n+    r\"https?://(?:www\\.)?bigo\\.tv/(?P<site_id>[^/]+)$\",\n ))\n class Bigo(Plugin):\n-    _api_url = \"https://www.bigo.tv/OInterface/getVideoParam?bigoId={0}\"\n-\n-    _video_info_schema = validate.Schema({\n-        \"code\": 0,\n-        \"msg\": \"success\",\n-        \"data\": {\n-            \"videoSrc\": validate.any(None, \"\", validate.url()),\n-        },\n-    })\n+    _URL_API = \"https://ta.bigo.tv/official_website/studio/getInternalStudioInfo\"\n \n     def _get_streams(self):\n-        res = self.session.http.get(\n-            self._api_url.format(self.match.group(1)),\n-            allow_redirects=True,\n-            headers={\"User-Agent\": useragents.IPHONE_6},\n+        self.id, self.author, self.category, self.title, hls_url = self.session.http.post(\n+            self._URL_API,\n+            params={\n+                \"siteId\": self.match[\"site_id\"],\n+                \"verify\": \"\",\n+            },\n+            schema=validate.Schema(\n+                validate.parse_json(),\n+                {\n+                    \"code\": 0,\n+                    \"msg\": \"success\",\n+                    \"data\": {\n+                        \"roomId\": validate.any(None, str),\n+                        \"clientBigoId\": validate.any(None, str),\n+                        \"gameTitle\": str,\n+                        \"roomTopic\": str,\n+                        \"hls_src\": validate.any(None, \"\", validate.url()),\n+                    },\n+                },\n+                validate.union_get(\n+                    (\"data\", \"roomId\"),\n+                    (\"data\", \"clientBigoId\"),\n+                    (\"data\", \"gameTitle\"),\n+                    (\"data\", \"roomTopic\"),\n+                    (\"data\", \"hls_src\"),\n+                ),\n+            ),\n         )\n-        data = self.session.http.json(res, schema=self._video_info_schema)\n-        videourl = data[\"data\"][\"videoSrc\"]\n-        if videourl:\n-            yield \"live\", HLSStream(self.session, videourl)\n+\n+        if not self.id:\n+            return\n+\n+        if not hls_url:\n+            log.info(\"Channel is offline\")\n+            return\n+\n+        yield \"live\", HLSStream(self.session, hls_url)\n \n \n __plugin__ = Bigo\n", "issue": "plugins.bigo: Unable to parse JSON\n### Checklist\n\n- [X] This is a [plugin issue](https://streamlink.github.io/plugins.html) and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)\n- [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)\n- [X] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)\n- [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)\n\n### Streamlink version\n\nLatest release\n\n### Description\n\nHello,\r\n\r\nthe bigo.py is not working at the moment.\r\n\r\nIt is giving a parse JSON error.\r\n\r\nDebug log is following...\n\n### Debug log\n\n```text\nerror: Unable to parse JSON: Expecting value: line 1 column 1 (char 0) ('<!DOCTYPE html>\\n<html lang=\"en\" s ...)\n```\n\n", "before_files": [{"content": "\"\"\"\n$description Global live streaming platform for live video game broadcasts and individual live streams.\n$url live.bigo.tv\n$url bigoweb.co\n$type live\n\"\"\"\n\nimport re\n\nfrom streamlink.plugin import Plugin, pluginmatcher\nfrom streamlink.plugin.api import useragents, validate\nfrom streamlink.stream.hls import HLSStream\n\n\n@pluginmatcher(re.compile(\n    r\"https?://(?:www\\.)?bigo\\.tv/([^/]+)$\",\n))\nclass Bigo(Plugin):\n    _api_url = \"https://www.bigo.tv/OInterface/getVideoParam?bigoId={0}\"\n\n    _video_info_schema = validate.Schema({\n        \"code\": 0,\n        \"msg\": \"success\",\n        \"data\": {\n            \"videoSrc\": validate.any(None, \"\", validate.url()),\n        },\n    })\n\n    def _get_streams(self):\n        res = self.session.http.get(\n            self._api_url.format(self.match.group(1)),\n            allow_redirects=True,\n            headers={\"User-Agent\": useragents.IPHONE_6},\n        )\n        data = self.session.http.json(res, schema=self._video_info_schema)\n        videourl = data[\"data\"][\"videoSrc\"]\n        if videourl:\n            yield \"live\", HLSStream(self.session, videourl)\n\n\n__plugin__ = Bigo\n", "path": "src/streamlink/plugins/bigo.py"}], "after_files": [{"content": "\"\"\"\n$description Global live-streaming platform for live video game broadcasts and individual live streams.\n$url bigo.tv\n$type live\n$metadata id\n$metadata author\n$metadata category\n$metadata title\n\"\"\"\n\nimport logging\nimport re\n\nfrom streamlink.plugin import Plugin, pluginmatcher\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream.hls import HLSStream\n\n\nlog = logging.getLogger(__name__)\n\n\n@pluginmatcher(re.compile(\n    r\"https?://(?:www\\.)?bigo\\.tv/(?P<site_id>[^/]+)$\",\n))\nclass Bigo(Plugin):\n    _URL_API = \"https://ta.bigo.tv/official_website/studio/getInternalStudioInfo\"\n\n    def _get_streams(self):\n        self.id, self.author, self.category, self.title, hls_url = self.session.http.post(\n            self._URL_API,\n            params={\n                \"siteId\": self.match[\"site_id\"],\n                \"verify\": \"\",\n            },\n            schema=validate.Schema(\n                validate.parse_json(),\n                {\n                    \"code\": 0,\n                    \"msg\": \"success\",\n                    \"data\": {\n                        \"roomId\": validate.any(None, str),\n                        \"clientBigoId\": validate.any(None, str),\n                        \"gameTitle\": str,\n                        \"roomTopic\": str,\n                        \"hls_src\": validate.any(None, \"\", validate.url()),\n                    },\n                },\n                validate.union_get(\n                    (\"data\", \"roomId\"),\n                    (\"data\", \"clientBigoId\"),\n                    (\"data\", \"gameTitle\"),\n                    (\"data\", \"roomTopic\"),\n                    (\"data\", \"hls_src\"),\n                ),\n            ),\n        )\n\n        if not self.id:\n            return\n\n        if not hls_url:\n            log.info(\"Channel is offline\")\n            return\n\n        yield \"live\", HLSStream(self.session, hls_url)\n\n\n__plugin__ = Bigo\n", "path": "src/streamlink/plugins/bigo.py"}]}