prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Huomao plugin not work
  <!--
  Thanks for reporting a plugin issue!
  USE THE TEMPLATE. Otherwise your plugin issue may be rejected.
  
  First, see the contribution guidelines:
  https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink
  
  Also check the list of open and closed plugin issues:
  https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22
  
  Please see the text preview to avoid unnecessary formatting errors.
  -->
  
  
  ## Plugin Issue
  
  <!-- Replace [ ] with [x] in order to check the box -->
  - [x] This is a plugin issue and I have read the contribution guidelines.
  
  
  ### Description
  I found huomao plugin seems not work, i can use browser to watch stream but
  streamlink says no playable stream
  
  
  <!-- Explain the plugin issue as thoroughly as you can. -->
  
  
  ### Reproduction steps / Explicit stream URLs to test
  
  <!-- How can we reproduce this? Please note the exact steps below using the list format supplied. If you need more steps please add them. -->
  
  1. https://www.huomao.com/9755
  2. https://www.huomao.com/777777
  3. https://www.huomao.com/888
  
  
  ### Log output
  
  <!--
  TEXT LOG OUTPUT IS REQUIRED for a plugin issue!
  Use the `--loglevel debug` parameter and avoid using parameters which suppress log output.
  https://streamlink.github.io/cli.html#cmdoption-l
  
  Make sure to **remove usernames and passwords**
  You can copy the output to https://gist.github.com/ or paste it below.
  -->
  
  ```
  [cli][info] Found matching plugin huomao for URL https://www.huomao.com/888
  [plugin.huomao][error] Failed to extract stream_info.
  error: No playable streams found on this URL: https://www.huomao.com/888
  ```
  
  
  
  
  --- 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/huomao.py`
  Content:
  ```
  1 """
  2 NOTE: Since a documented API is nowhere to be found for Huomao; this plugin
  3 simply extracts the videos stream_id, stream_url and stream_quality by
  4 scraping the HTML and JS of one of Huomaos mobile webpages.
  5 
  6 When viewing a stream on huomao.com, the base URL references a room_id. This
  7 room_id is mapped one-to-one to a stream_id which references the actual .flv
  8 video. Both stream_id, stream_url and stream_quality can be found in the
  9 HTML and JS source of the mobile_page. Since one stream can occur in many
  10 different qualities, we scrape all stream_url and stream_quality occurrences
  11 and return each option to the user.
  12 """
  13 
  14 import re
  15 
  16 from streamlink.plugin import Plugin
  17 from streamlink.stream import HTTPStream
  18 
  19 # URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.
  20 url_re = re.compile(r"""
  21     (http(s)?://)?
  22     (www\.)?
  23     huomao
  24     (\.tv|\.com)
  25     /(?P<room_id>\d+)
  26 """, re.VERBOSE)
  27 
  28 # URL used to retrive the stream_id, stream_url and stream_quality based of
  29 # a room_id.
  30 mobile_url = "http://www.huomao.com/mobile/mob_live/{0}"
  31 
  32 # Pattern for extracting the stream_id from the mobile_url HTML.
  33 #
  34 # Example from HTML:
  35 #   <input id="html_stream" value="efmrCH" type="hidden">
  36 stream_id_pattern = re.compile(r'id=\"html_stream\" value=\"(?P<stream_id>\w+)\"')
  37 
  38 # Pattern for extracting each stream_url, stream_quality_url and a prettified
  39 # stream_quality_name used for quality naming.
  40 #
  41 # Example from HTML:
  42 #   "2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'"
  43 stream_info_pattern = re.compile(r"""
  44     [1-9]:
  45     \s+
  46     '(?P<stream_url>(?:\w|\.|:|-|/)+)
  47     '\+stream\+'
  48     (?P<stream_quality_url>_?(?P<stream_quality_name>\d*))
  49     /playlist.m3u8'
  50 """, re.VERBOSE)
  51 
  52 
  53 class Huomao(Plugin):
  54     @classmethod
  55     def can_handle_url(self, url):
  56         return url_re.match(url)
  57 
  58     def get_stream_id(self, html):
  59         """Returns the stream_id contained in the HTML."""
  60         stream_id = stream_id_pattern.search(html)
  61 
  62         if not stream_id:
  63             self.logger.error("Failed to extract stream_id.")
  64 
  65         return stream_id.group("stream_id")
  66 
  67     def get_stream_info(self, html):
  68         """Returns a nested list of different stream options.
  69 
  70         Each entry in the list will contain a stream_url, stream_quality_url
  71         and stream_quality_name for each stream occurrence that was found in
  72         the JS.
  73         """
  74         stream_info = stream_info_pattern.findall(html)
  75 
  76         if not stream_info:
  77             self.logger.error("Failed to extract stream_info.")
  78 
  79         # Rename the "" quality to "source" by transforming the tuples to a
  80         # list and reassigning.
  81         stream_info_list = []
  82         for info in stream_info:
  83             if not info[2]:
  84                 stream_info_list.append([info[0], info[1], "source"])
  85             else:
  86                 stream_info_list.append(list(info))
  87 
  88         return stream_info_list
  89 
  90     def _get_streams(self):
  91         room_id = url_re.search(self.url).group("room_id")
  92         html = self.session.http.get(mobile_url.format(room_id))
  93         stream_id = self.get_stream_id(html.text)
  94         stream_info = self.get_stream_info(html.text)
  95 
  96         streams = {}
  97         for info in stream_info:
  98             streams[info[2]] = HTTPStream(self.session,
  99                                           info[0] + stream_id + info[1] + ".flv")
  100 
  101         return streams
  102 
  103 
  104 __plugin__ = Huomao
  105
  ```
  --- 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/huomao.py b/src/streamlink/plugins/huomao.py
  --- a/src/streamlink/plugins/huomao.py
  +++ b/src/streamlink/plugins/huomao.py
  @@ -4,8 +4,8 @@
   scraping the HTML and JS of one of Huomaos mobile webpages.
   
   When viewing a stream on huomao.com, the base URL references a room_id. This
  -room_id is mapped one-to-one to a stream_id which references the actual .flv
  -video. Both stream_id, stream_url and stream_quality can be found in the
  +room_id is mapped one-to-one to a stream_id which references the actual .m3u8
  +file. Both stream_id, stream_url and stream_quality can be found in the
   HTML and JS source of the mobile_page. Since one stream can occur in many
   different qualities, we scrape all stream_url and stream_quality occurrences
   and return each option to the user.
  @@ -14,7 +14,7 @@
   import re
   
   from streamlink.plugin import Plugin
  -from streamlink.stream import HTTPStream
  +from streamlink.stream import HLSStream
   
   # URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.
   url_re = re.compile(r"""
  @@ -35,18 +35,15 @@
   #   <input id="html_stream" value="efmrCH" type="hidden">
   stream_id_pattern = re.compile(r'id=\"html_stream\" value=\"(?P<stream_id>\w+)\"')
   
  -# Pattern for extracting each stream_url, stream_quality_url and a prettified
  +# Pattern for extracting each stream_url and
   # stream_quality_name used for quality naming.
   #
   # Example from HTML:
  -#   "2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'"
  +#   src="http://live-ws-hls.huomaotv.cn/live/<stream_id>_720/playlist.m3u8"
   stream_info_pattern = re.compile(r"""
  -    [1-9]:
  -    \s+
  -    '(?P<stream_url>(?:\w|\.|:|-|/)+)
  -    '\+stream\+'
  -    (?P<stream_quality_url>_?(?P<stream_quality_name>\d*))
  -    /playlist.m3u8'
  +    (?P<stream_url>(?:[\w\/\.\-:]+)
  +    \/[^_\"]+(?:_(?P<stream_quality_name>\d+))
  +    ?/playlist.m3u8)
   """, re.VERBOSE)
   
   
  @@ -65,11 +62,11 @@
           return stream_id.group("stream_id")
   
       def get_stream_info(self, html):
  -        """Returns a nested list of different stream options.
  +        """
  +        Returns a nested list of different stream options.
   
  -        Each entry in the list will contain a stream_url, stream_quality_url
  -        and stream_quality_name for each stream occurrence that was found in
  -        the JS.
  +        Each entry in the list will contain a stream_url and stream_quality_name
  +        for each stream occurrence that was found in the JS.
           """
           stream_info = stream_info_pattern.findall(html)
   
  @@ -80,8 +77,8 @@
           # list and reassigning.
           stream_info_list = []
           for info in stream_info:
  -            if not info[2]:
  -                stream_info_list.append([info[0], info[1], "source"])
  +            if not info[1]:
  +                stream_info_list.append([info[0], "source"])
               else:
                   stream_info_list.append(list(info))
   
  @@ -95,8 +92,8 @@
   
           streams = {}
           for info in stream_info:
  -            streams[info[2]] = HTTPStream(self.session,
  -                                          info[0] + stream_id + info[1] + ".flv")
  +            if stream_id in info[0]:
  +                streams[info[1]] = HLSStream(self.session, info[0])
   
           return streams
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/huomao.py b/src/streamlink/plugins/huomao.py\n--- a/src/streamlink/plugins/huomao.py\n+++ b/src/streamlink/plugins/huomao.py\n@@ -4,8 +4,8 @@\n scraping the HTML and JS of one of Huomaos mobile webpages.\n \n When viewing a stream on huomao.com, the base URL references a room_id. This\n-room_id is mapped one-to-one to a stream_id which references the actual .flv\n-video. Both stream_id, stream_url and stream_quality can be found in the\n+room_id is mapped one-to-one to a stream_id which references the actual .m3u8\n+file. Both stream_id, stream_url and stream_quality can be found in the\n HTML and JS source of the mobile_page. Since one stream can occur in many\n different qualities, we scrape all stream_url and stream_quality occurrences\n and return each option to the user.\n@@ -14,7 +14,7 @@\n import re\n \n from streamlink.plugin import Plugin\n-from streamlink.stream import HTTPStream\n+from streamlink.stream import HLSStream\n \n # URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.\n url_re = re.compile(r\"\"\"\n@@ -35,18 +35,15 @@\n #   <input id=\"html_stream\" value=\"efmrCH\" type=\"hidden\">\n stream_id_pattern = re.compile(r'id=\\\"html_stream\\\" value=\\\"(?P<stream_id>\\w+)\\\"')\n \n-# Pattern for extracting each stream_url, stream_quality_url and a prettified\n+# Pattern for extracting each stream_url and\n # stream_quality_name used for quality naming.\n #\n # Example from HTML:\n-#   \"2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'\"\n+#   src=\"http://live-ws-hls.huomaotv.cn/live/<stream_id>_720/playlist.m3u8\"\n stream_info_pattern = re.compile(r\"\"\"\n-    [1-9]:\n-    \\s+\n-    '(?P<stream_url>(?:\\w|\\.|:|-|/)+)\n-    '\\+stream\\+'\n-    (?P<stream_quality_url>_?(?P<stream_quality_name>\\d*))\n-    /playlist.m3u8'\n+    (?P<stream_url>(?:[\\w\\/\\.\\-:]+)\n+    \\/[^_\\\"]+(?:_(?P<stream_quality_name>\\d+))\n+    ?/playlist.m3u8)\n \"\"\", re.VERBOSE)\n \n \n@@ -65,11 +62,11 @@\n         return stream_id.group(\"stream_id\")\n \n     def get_stream_info(self, html):\n-        \"\"\"Returns a nested list of different stream options.\n+        \"\"\"\n+        Returns a nested list of different stream options.\n \n-        Each entry in the list will contain a stream_url, stream_quality_url\n-        and stream_quality_name for each stream occurrence that was found in\n-        the JS.\n+        Each entry in the list will contain a stream_url and stream_quality_name\n+        for each stream occurrence that was found in the JS.\n         \"\"\"\n         stream_info = stream_info_pattern.findall(html)\n \n@@ -80,8 +77,8 @@\n         # list and reassigning.\n         stream_info_list = []\n         for info in stream_info:\n-            if not info[2]:\n-                stream_info_list.append([info[0], info[1], \"source\"])\n+            if not info[1]:\n+                stream_info_list.append([info[0], \"source\"])\n             else:\n                 stream_info_list.append(list(info))\n \n@@ -95,8 +92,8 @@\n \n         streams = {}\n         for info in stream_info:\n-            streams[info[2]] = HTTPStream(self.session,\n-                                          info[0] + stream_id + info[1] + \".flv\")\n+            if stream_id in info[0]:\n+                streams[info[1]] = HLSStream(self.session, info[0])\n \n         return streams\n", "issue": "Huomao plugin not work\n<!--\r\nThanks for reporting a plugin issue!\r\nUSE THE TEMPLATE. Otherwise your plugin issue may be rejected.\r\n\r\nFirst, see the contribution guidelines:\r\nhttps://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink\r\n\r\nAlso check the list of open and closed plugin issues:\r\nhttps://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22\r\n\r\nPlease see the text preview to avoid unnecessary formatting errors.\r\n-->\r\n\r\n\r\n## Plugin Issue\r\n\r\n<!-- Replace [ ] with [x] in order to check the box -->\r\n- [x] This is a plugin issue and I have read the contribution guidelines.\r\n\r\n\r\n### Description\r\nI found huomao plugin seems not work, i can use browser to watch stream but\r\nstreamlink says no playable stream\r\n\r\n\r\n<!-- Explain the plugin issue as thoroughly as you can. -->\r\n\r\n\r\n### Reproduction steps / Explicit stream URLs to test\r\n\r\n<!-- How can we reproduce this? Please note the exact steps below using the list format supplied. If you need more steps please add them. -->\r\n\r\n1. https://www.huomao.com/9755\r\n2. https://www.huomao.com/777777\r\n3. https://www.huomao.com/888\r\n\r\n\r\n### Log output\r\n\r\n<!--\r\nTEXT LOG OUTPUT IS REQUIRED for a plugin issue!\r\nUse the `--loglevel debug` parameter and avoid using parameters which suppress log output.\r\nhttps://streamlink.github.io/cli.html#cmdoption-l\r\n\r\nMake sure to **remove usernames and passwords**\r\nYou can copy the output to https://gist.github.com/ or paste it below.\r\n-->\r\n\r\n```\r\n[cli][info] Found matching plugin huomao for URL https://www.huomao.com/888\r\n[plugin.huomao][error] Failed to extract stream_info.\r\nerror: No playable streams found on this URL: https://www.huomao.com/888\r\n```\r\n\r\n\r\n\n", "before_files": [{"content": "\"\"\"\nNOTE: Since a documented API is nowhere to be found for Huomao; this plugin\nsimply extracts the videos stream_id, stream_url and stream_quality by\nscraping the HTML and JS of one of Huomaos mobile webpages.\n\nWhen viewing a stream on huomao.com, the base URL references a room_id. This\nroom_id is mapped one-to-one to a stream_id which references the actual .flv\nvideo. Both stream_id, stream_url and stream_quality can be found in the\nHTML and JS source of the mobile_page. Since one stream can occur in many\ndifferent qualities, we scrape all stream_url and stream_quality occurrences\nand return each option to the user.\n\"\"\"\n\nimport re\n\nfrom streamlink.plugin import Plugin\nfrom streamlink.stream import HTTPStream\n\n# URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.\nurl_re = re.compile(r\"\"\"\n    (http(s)?://)?\n    (www\\.)?\n    huomao\n    (\\.tv|\\.com)\n    /(?P<room_id>\\d+)\n\"\"\", re.VERBOSE)\n\n# URL used to retrive the stream_id, stream_url and stream_quality based of\n# a room_id.\nmobile_url = \"http://www.huomao.com/mobile/mob_live/{0}\"\n\n# Pattern for extracting the stream_id from the mobile_url HTML.\n#\n# Example from HTML:\n#   <input id=\"html_stream\" value=\"efmrCH\" type=\"hidden\">\nstream_id_pattern = re.compile(r'id=\\\"html_stream\\\" value=\\\"(?P<stream_id>\\w+)\\\"')\n\n# Pattern for extracting each stream_url, stream_quality_url and a prettified\n# stream_quality_name used for quality naming.\n#\n# Example from HTML:\n#   \"2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'\"\nstream_info_pattern = re.compile(r\"\"\"\n    [1-9]:\n    \\s+\n    '(?P<stream_url>(?:\\w|\\.|:|-|/)+)\n    '\\+stream\\+'\n    (?P<stream_quality_url>_?(?P<stream_quality_name>\\d*))\n    /playlist.m3u8'\n\"\"\", re.VERBOSE)\n\n\nclass Huomao(Plugin):\n    @classmethod\n    def can_handle_url(self, url):\n        return url_re.match(url)\n\n    def get_stream_id(self, html):\n        \"\"\"Returns the stream_id contained in the HTML.\"\"\"\n        stream_id = stream_id_pattern.search(html)\n\n        if not stream_id:\n            self.logger.error(\"Failed to extract stream_id.\")\n\n        return stream_id.group(\"stream_id\")\n\n    def get_stream_info(self, html):\n        \"\"\"Returns a nested list of different stream options.\n\n        Each entry in the list will contain a stream_url, stream_quality_url\n        and stream_quality_name for each stream occurrence that was found in\n        the JS.\n        \"\"\"\n        stream_info = stream_info_pattern.findall(html)\n\n        if not stream_info:\n            self.logger.error(\"Failed to extract stream_info.\")\n\n        # Rename the \"\" quality to \"source\" by transforming the tuples to a\n        # list and reassigning.\n        stream_info_list = []\n        for info in stream_info:\n            if not info[2]:\n                stream_info_list.append([info[0], info[1], \"source\"])\n            else:\n                stream_info_list.append(list(info))\n\n        return stream_info_list\n\n    def _get_streams(self):\n        room_id = url_re.search(self.url).group(\"room_id\")\n        html = self.session.http.get(mobile_url.format(room_id))\n        stream_id = self.get_stream_id(html.text)\n        stream_info = self.get_stream_info(html.text)\n\n        streams = {}\n        for info in stream_info:\n            streams[info[2]] = HTTPStream(self.session,\n                                          info[0] + stream_id + info[1] + \".flv\")\n\n        return streams\n\n\n__plugin__ = Huomao\n", "path": "src/streamlink/plugins/huomao.py"}], "after_files": [{"content": "\"\"\"\nNOTE: Since a documented API is nowhere to be found for Huomao; this plugin\nsimply extracts the videos stream_id, stream_url and stream_quality by\nscraping the HTML and JS of one of Huomaos mobile webpages.\n\nWhen viewing a stream on huomao.com, the base URL references a room_id. This\nroom_id is mapped one-to-one to a stream_id which references the actual .m3u8\nfile. Both stream_id, stream_url and stream_quality can be found in the\nHTML and JS source of the mobile_page. Since one stream can occur in many\ndifferent qualities, we scrape all stream_url and stream_quality occurrences\nand return each option to the user.\n\"\"\"\n\nimport re\n\nfrom streamlink.plugin import Plugin\nfrom streamlink.stream import HLSStream\n\n# URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.\nurl_re = re.compile(r\"\"\"\n    (http(s)?://)?\n    (www\\.)?\n    huomao\n    (\\.tv|\\.com)\n    /(?P<room_id>\\d+)\n\"\"\", re.VERBOSE)\n\n# URL used to retrive the stream_id, stream_url and stream_quality based of\n# a room_id.\nmobile_url = \"http://www.huomao.com/mobile/mob_live/{0}\"\n\n# Pattern for extracting the stream_id from the mobile_url HTML.\n#\n# Example from HTML:\n#   <input id=\"html_stream\" value=\"efmrCH\" type=\"hidden\">\nstream_id_pattern = re.compile(r'id=\\\"html_stream\\\" value=\\\"(?P<stream_id>\\w+)\\\"')\n\n# Pattern for extracting each stream_url and\n# stream_quality_name used for quality naming.\n#\n# Example from HTML:\n#   src=\"http://live-ws-hls.huomaotv.cn/live/<stream_id>_720/playlist.m3u8\"\nstream_info_pattern = re.compile(r\"\"\"\n    (?P<stream_url>(?:[\\w\\/\\.\\-:]+)\n    \\/[^_\\\"]+(?:_(?P<stream_quality_name>\\d+))\n    ?/playlist.m3u8)\n\"\"\", re.VERBOSE)\n\n\nclass Huomao(Plugin):\n    @classmethod\n    def can_handle_url(self, url):\n        return url_re.match(url)\n\n    def get_stream_id(self, html):\n        \"\"\"Returns the stream_id contained in the HTML.\"\"\"\n        stream_id = stream_id_pattern.search(html)\n\n        if not stream_id:\n            self.logger.error(\"Failed to extract stream_id.\")\n\n        return stream_id.group(\"stream_id\")\n\n    def get_stream_info(self, html):\n        \"\"\"\n        Returns a nested list of different stream options.\n\n        Each entry in the list will contain a stream_url and stream_quality_name\n        for each stream occurrence that was found in the JS.\n        \"\"\"\n        stream_info = stream_info_pattern.findall(html)\n\n        if not stream_info:\n            self.logger.error(\"Failed to extract stream_info.\")\n\n        # Rename the \"\" quality to \"source\" by transforming the tuples to a\n        # list and reassigning.\n        stream_info_list = []\n        for info in stream_info:\n            if not info[1]:\n                stream_info_list.append([info[0], \"source\"])\n            else:\n                stream_info_list.append(list(info))\n\n        return stream_info_list\n\n    def _get_streams(self):\n        room_id = url_re.search(self.url).group(\"room_id\")\n        html = self.session.http.get(mobile_url.format(room_id))\n        stream_id = self.get_stream_id(html.text)\n        stream_info = self.get_stream_info(html.text)\n\n        streams = {}\n        for info in stream_info:\n            if stream_id in info[0]:\n                streams[info[1]] = HLSStream(self.session, info[0])\n\n        return streams\n\n\n__plugin__ = Huomao\n", "path": "src/streamlink/plugins/huomao.py"}]}