prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  plugins.huya: As of today, Huya plugin has been broken
  ### Checklist
  
  - [X] This is a plugin issue and not a different kind of issue
  - [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 stable release
  
  ### Description
  
  When I try to open any public Huya stream I get an error message. Assuming Huya has changed how live IDs are handled and switched to strings.
  
  ### Debug log
  
  ```text
  hina@Hinas-MacBook-Pro ~ % streamlink https://www.huya.com/660108 best --loglevel debug
  [cli][debug] OS:         macOS 12.5
  [cli][debug] Python:     3.10.6
  [cli][debug] Streamlink: 4.3.0
  [cli][debug] Dependencies:
  [cli][debug]  isodate: 0.6.1
  [cli][debug]  lxml: 4.9.1
  [cli][debug]  pycountry: 22.3.5
  [cli][debug]  pycryptodome: 3.15.0
  [cli][debug]  PySocks: 1.7.1
  [cli][debug]  requests: 2.28.1
  [cli][debug]  websocket-client: 1.3.3
  [cli][debug] Arguments:
  [cli][debug]  url=https://www.huya.com/660108
  [cli][debug]  stream=['best']
  [cli][debug]  --loglevel=debug
  [cli][info] Found matching plugin huya for URL https://www.huya.com/660108
  error: Unable to validate response text: ValidationError(NoneOrAllSchema):
    ValidationError(dict):
      Unable to validate value of key 'data'
      Context(AnySchema):
        ValidationError(dict):
          Unable to validate value of key 'gameLiveInfo'
          Context(dict):
            Unable to validate value of key 'liveId'
            Context(type):
              Type of '7134607205476108031' should be int, but is str
  hina@Hinas-MacBook-Pro ~ %
  ```
  
  
  --- 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/huya.py`
  Content:
  ```
  1 """
  2 $description Chinese live-streaming platform for live video game broadcasts and individual live streams.
  3 $url huya.com
  4 $type live
  5 """
  6 
  7 import base64
  8 import logging
  9 import re
  10 from html import unescape as html_unescape
  11 from typing import Dict
  12 
  13 from streamlink.plugin import Plugin, pluginmatcher
  14 from streamlink.plugin.api import validate
  15 from streamlink.stream.http import HTTPStream
  16 
  17 log = logging.getLogger(__name__)
  18 
  19 
  20 @pluginmatcher(re.compile(
  21     r"https?://(?:www\.)?huya\.com/(?P<channel>[^/]+)"
  22 ))
  23 class Huya(Plugin):
  24     QUALITY_WEIGHTS: Dict[str, int] = {}
  25 
  26     @classmethod
  27     def stream_weight(cls, key):
  28         weight = cls.QUALITY_WEIGHTS.get(key)
  29         if weight:
  30             return weight, "huya"
  31 
  32         return super().stream_weight(key)
  33 
  34     def _get_streams(self):
  35         data = self.session.http.get(self.url, schema=validate.Schema(
  36             validate.parse_html(),
  37             validate.xml_xpath_string(".//script[contains(text(),'var hyPlayerConfig = {')][1]/text()"),
  38             validate.none_or_all(
  39                 re.compile(r"""(?P<q>"?)stream(?P=q)\s*:\s*(?:"(?P<base64>.+?)"|(?P<json>\{.+?})\s*}\s*;)"""),
  40             ),
  41             validate.none_or_all(
  42                 validate.any(
  43                     validate.all(
  44                         validate.get("base64"),
  45                         str,
  46                         validate.transform(base64.b64decode),
  47                     ),
  48                     validate.all(
  49                         validate.get("json"),
  50                         str,
  51                     ),
  52                 ),
  53                 validate.parse_json(),
  54                 {
  55                     "data": [{
  56                         "gameLiveInfo": {
  57                             "liveId": int,
  58                             "nick": str,
  59                             "roomName": str,
  60                         },
  61                         "gameStreamInfoList": [validate.all(
  62                             {
  63                                 "sCdnType": str,
  64                                 "iPCPriorityRate": int,
  65                                 "sStreamName": str,
  66                                 "sFlvUrl": str,
  67                                 "sFlvUrlSuffix": str,
  68                                 "sFlvAntiCode": validate.all(str, validate.transform(lambda v: html_unescape(v))),
  69                             },
  70                             validate.union_get(
  71                                 "sCdnType",
  72                                 "iPCPriorityRate",
  73                                 "sStreamName",
  74                                 "sFlvUrl",
  75                                 "sFlvUrlSuffix",
  76                                 "sFlvAntiCode",
  77                             )),
  78                         ],
  79                     }],
  80                 },
  81                 validate.get(("data", 0)),
  82                 validate.union_get(
  83                     ("gameLiveInfo", "liveId"),
  84                     ("gameLiveInfo", "nick"),
  85                     ("gameLiveInfo", "roomName"),
  86                     "gameStreamInfoList",
  87                 ),
  88             ),
  89         ))
  90         if not data:
  91             return
  92 
  93         self.id, self.author, self.title, streamdata = data
  94 
  95         for cdntype, priority, streamname, flvurl, suffix, anticode in streamdata:
  96             name = f"source_{cdntype.lower()}"
  97             self.QUALITY_WEIGHTS[name] = priority
  98             yield name, HTTPStream(self.session, f"{flvurl}/{streamname}.{suffix}?{anticode}")
  99 
  100         log.debug(f"QUALITY_WEIGHTS: {self.QUALITY_WEIGHTS!r}")
  101 
  102 
  103 __plugin__ = Huya
  104
  ```
  --- 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/huya.py b/src/streamlink/plugins/huya.py
  --- a/src/streamlink/plugins/huya.py
  +++ b/src/streamlink/plugins/huya.py
  @@ -54,7 +54,7 @@
                   {
                       "data": [{
                           "gameLiveInfo": {
  -                            "liveId": int,
  +                            "liveId": str,
                               "nick": str,
                               "roomName": str,
                           },
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/huya.py b/src/streamlink/plugins/huya.py\n--- a/src/streamlink/plugins/huya.py\n+++ b/src/streamlink/plugins/huya.py\n@@ -54,7 +54,7 @@\n                 {\n                     \"data\": [{\n                         \"gameLiveInfo\": {\n-                            \"liveId\": int,\n+                            \"liveId\": str,\n                             \"nick\": str,\n                             \"roomName\": str,\n                         },\n", "issue": "plugins.huya: As of today, Huya plugin has been broken\n### Checklist\n\n- [X] This is a plugin issue and not a different kind of issue\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 stable release\n\n### Description\n\nWhen I try to open any public Huya stream I get an error message. Assuming Huya has changed how live IDs are handled and switched to strings.\n\n### Debug log\n\n```text\nhina@Hinas-MacBook-Pro ~ % streamlink https://www.huya.com/660108 best --loglevel debug\r\n[cli][debug] OS:         macOS 12.5\r\n[cli][debug] Python:     3.10.6\r\n[cli][debug] Streamlink: 4.3.0\r\n[cli][debug] Dependencies:\r\n[cli][debug]  isodate: 0.6.1\r\n[cli][debug]  lxml: 4.9.1\r\n[cli][debug]  pycountry: 22.3.5\r\n[cli][debug]  pycryptodome: 3.15.0\r\n[cli][debug]  PySocks: 1.7.1\r\n[cli][debug]  requests: 2.28.1\r\n[cli][debug]  websocket-client: 1.3.3\r\n[cli][debug] Arguments:\r\n[cli][debug]  url=https://www.huya.com/660108\r\n[cli][debug]  stream=['best']\r\n[cli][debug]  --loglevel=debug\r\n[cli][info] Found matching plugin huya for URL https://www.huya.com/660108\r\nerror: Unable to validate response text: ValidationError(NoneOrAllSchema):\r\n  ValidationError(dict):\r\n    Unable to validate value of key 'data'\r\n    Context(AnySchema):\r\n      ValidationError(dict):\r\n        Unable to validate value of key 'gameLiveInfo'\r\n        Context(dict):\r\n          Unable to validate value of key 'liveId'\r\n          Context(type):\r\n            Type of '7134607205476108031' should be int, but is str\r\nhina@Hinas-MacBook-Pro ~ %\n```\n\n", "before_files": [{"content": "\"\"\"\n$description Chinese live-streaming platform for live video game broadcasts and individual live streams.\n$url huya.com\n$type live\n\"\"\"\n\nimport base64\nimport logging\nimport re\nfrom html import unescape as html_unescape\nfrom typing import Dict\n\nfrom streamlink.plugin import Plugin, pluginmatcher\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream.http import HTTPStream\n\nlog = logging.getLogger(__name__)\n\n\n@pluginmatcher(re.compile(\n    r\"https?://(?:www\\.)?huya\\.com/(?P<channel>[^/]+)\"\n))\nclass Huya(Plugin):\n    QUALITY_WEIGHTS: Dict[str, int] = {}\n\n    @classmethod\n    def stream_weight(cls, key):\n        weight = cls.QUALITY_WEIGHTS.get(key)\n        if weight:\n            return weight, \"huya\"\n\n        return super().stream_weight(key)\n\n    def _get_streams(self):\n        data = self.session.http.get(self.url, schema=validate.Schema(\n            validate.parse_html(),\n            validate.xml_xpath_string(\".//script[contains(text(),'var hyPlayerConfig = {')][1]/text()\"),\n            validate.none_or_all(\n                re.compile(r\"\"\"(?P<q>\"?)stream(?P=q)\\s*:\\s*(?:\"(?P<base64>.+?)\"|(?P<json>\\{.+?})\\s*}\\s*;)\"\"\"),\n            ),\n            validate.none_or_all(\n                validate.any(\n                    validate.all(\n                        validate.get(\"base64\"),\n                        str,\n                        validate.transform(base64.b64decode),\n                    ),\n                    validate.all(\n                        validate.get(\"json\"),\n                        str,\n                    ),\n                ),\n                validate.parse_json(),\n                {\n                    \"data\": [{\n                        \"gameLiveInfo\": {\n                            \"liveId\": int,\n                            \"nick\": str,\n                            \"roomName\": str,\n                        },\n                        \"gameStreamInfoList\": [validate.all(\n                            {\n                                \"sCdnType\": str,\n                                \"iPCPriorityRate\": int,\n                                \"sStreamName\": str,\n                                \"sFlvUrl\": str,\n                                \"sFlvUrlSuffix\": str,\n                                \"sFlvAntiCode\": validate.all(str, validate.transform(lambda v: html_unescape(v))),\n                            },\n                            validate.union_get(\n                                \"sCdnType\",\n                                \"iPCPriorityRate\",\n                                \"sStreamName\",\n                                \"sFlvUrl\",\n                                \"sFlvUrlSuffix\",\n                                \"sFlvAntiCode\",\n                            )),\n                        ],\n                    }],\n                },\n                validate.get((\"data\", 0)),\n                validate.union_get(\n                    (\"gameLiveInfo\", \"liveId\"),\n                    (\"gameLiveInfo\", \"nick\"),\n                    (\"gameLiveInfo\", \"roomName\"),\n                    \"gameStreamInfoList\",\n                ),\n            ),\n        ))\n        if not data:\n            return\n\n        self.id, self.author, self.title, streamdata = data\n\n        for cdntype, priority, streamname, flvurl, suffix, anticode in streamdata:\n            name = f\"source_{cdntype.lower()}\"\n            self.QUALITY_WEIGHTS[name] = priority\n            yield name, HTTPStream(self.session, f\"{flvurl}/{streamname}.{suffix}?{anticode}\")\n\n        log.debug(f\"QUALITY_WEIGHTS: {self.QUALITY_WEIGHTS!r}\")\n\n\n__plugin__ = Huya\n", "path": "src/streamlink/plugins/huya.py"}], "after_files": [{"content": "\"\"\"\n$description Chinese live-streaming platform for live video game broadcasts and individual live streams.\n$url huya.com\n$type live\n\"\"\"\n\nimport base64\nimport logging\nimport re\nfrom html import unescape as html_unescape\nfrom typing import Dict\n\nfrom streamlink.plugin import Plugin, pluginmatcher\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream.http import HTTPStream\n\nlog = logging.getLogger(__name__)\n\n\n@pluginmatcher(re.compile(\n    r\"https?://(?:www\\.)?huya\\.com/(?P<channel>[^/]+)\"\n))\nclass Huya(Plugin):\n    QUALITY_WEIGHTS: Dict[str, int] = {}\n\n    @classmethod\n    def stream_weight(cls, key):\n        weight = cls.QUALITY_WEIGHTS.get(key)\n        if weight:\n            return weight, \"huya\"\n\n        return super().stream_weight(key)\n\n    def _get_streams(self):\n        data = self.session.http.get(self.url, schema=validate.Schema(\n            validate.parse_html(),\n            validate.xml_xpath_string(\".//script[contains(text(),'var hyPlayerConfig = {')][1]/text()\"),\n            validate.none_or_all(\n                re.compile(r\"\"\"(?P<q>\"?)stream(?P=q)\\s*:\\s*(?:\"(?P<base64>.+?)\"|(?P<json>\\{.+?})\\s*}\\s*;)\"\"\"),\n            ),\n            validate.none_or_all(\n                validate.any(\n                    validate.all(\n                        validate.get(\"base64\"),\n                        str,\n                        validate.transform(base64.b64decode),\n                    ),\n                    validate.all(\n                        validate.get(\"json\"),\n                        str,\n                    ),\n                ),\n                validate.parse_json(),\n                {\n                    \"data\": [{\n                        \"gameLiveInfo\": {\n                            \"liveId\": str,\n                            \"nick\": str,\n                            \"roomName\": str,\n                        },\n                        \"gameStreamInfoList\": [validate.all(\n                            {\n                                \"sCdnType\": str,\n                                \"iPCPriorityRate\": int,\n                                \"sStreamName\": str,\n                                \"sFlvUrl\": str,\n                                \"sFlvUrlSuffix\": str,\n                                \"sFlvAntiCode\": validate.all(str, validate.transform(lambda v: html_unescape(v))),\n                            },\n                            validate.union_get(\n                                \"sCdnType\",\n                                \"iPCPriorityRate\",\n                                \"sStreamName\",\n                                \"sFlvUrl\",\n                                \"sFlvUrlSuffix\",\n                                \"sFlvAntiCode\",\n                            )),\n                        ],\n                    }],\n                },\n                validate.get((\"data\", 0)),\n                validate.union_get(\n                    (\"gameLiveInfo\", \"liveId\"),\n                    (\"gameLiveInfo\", \"nick\"),\n                    (\"gameLiveInfo\", \"roomName\"),\n                    \"gameStreamInfoList\",\n                ),\n            ),\n        ))\n        if not data:\n            return\n\n        self.id, self.author, self.title, streamdata = data\n\n        for cdntype, priority, streamname, flvurl, suffix, anticode in streamdata:\n            name = f\"source_{cdntype.lower()}\"\n            self.QUALITY_WEIGHTS[name] = priority\n            yield name, HTTPStream(self.session, f\"{flvurl}/{streamname}.{suffix}?{anticode}\")\n\n        log.debug(f\"QUALITY_WEIGHTS: {self.QUALITY_WEIGHTS!r}\")\n\n\n__plugin__ = Huya\n", "path": "src/streamlink/plugins/huya.py"}]}