prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  plugins.ard_live: Unable to parse MEDIAINFO
  ### 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
  
  On streamlink 3.1.1 Linux:
  
  ```
  [cli][info] Found matching plugin ard_live for URL https://live.daserste.de/
  error: Unable to validate response text: Unable to parse MEDIAINFO: Expecting value: line 1 column 1 (char 0) ('<!DOCTYPE HTML>\n<html lang="de" i ...)
  ```
  
  Streamlink 2.0.0 Windows works fine. Can't find a working 2.0.0 Linux build to verify.
  
  3.1.1 seems to expect a player url at `https://live.daserste.de/live-de-102~playerJson.json` and 2.0.0 at `https://www.daserste.de/live/live-de-102~playerJson.json`.
  
  Is there a commandline arg to override it?
  
  ### Debug log
  
  ```text
  [cli][debug] OS:         Linux-5.15.2-arch1-1-x86_64-with-glibc2.35
  [cli][debug] Python:     3.10.2
  [cli][debug] Streamlink: 3.1.1
  [cli][debug] Requests(2.27.0), Socks(1.7.1), Websocket(1.2.3)
  [cli][debug] Arguments:
  [cli][debug]  url=https://live.daserste.de/
  [cli][debug]  --loglevel=debug
  [cli][info] Found matching plugin ard_live for URL https://live.daserste.de/
  [plugins.ard_live][debug] Player URL: 'https://live.daserste.de/live-de-102~playerJson.json'
  error: Unable to validate response text: Unable to parse MEDIAINFO: Expecting value: line 1 column 1 (char 0) ('<!DOCTYPE HTML>\n<html lang="de" i ...)
  ```
  
  
  --- 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/ard_live.py`
  Content:
  ```
  1 import logging
  2 import re
  3 from urllib.parse import urljoin
  4 
  5 from streamlink.plugin import Plugin, PluginError, pluginmatcher
  6 from streamlink.plugin.api import validate
  7 from streamlink.stream.hls import HLSStream
  8 from streamlink.stream.http import HTTPStream
  9 
  10 log = logging.getLogger(__name__)
  11 
  12 
  13 @pluginmatcher(re.compile(
  14     r"https?://((www|live)\.)?daserste\.de/"
  15 ))
  16 class ARDLive(Plugin):
  17     _QUALITY_MAP = {
  18         4: "1080p",
  19         3: "720p",
  20         2: "540p",
  21         1: "270p",
  22         0: "180p"
  23     }
  24 
  25     def _get_streams(self):
  26         try:
  27             data_url = self.session.http.get(self.url, schema=validate.Schema(
  28                 validate.parse_html(),
  29                 validate.xml_find(".//*[@data-ctrl-player]"),
  30                 validate.get("data-ctrl-player"),
  31                 validate.transform(lambda s: s.replace("'", "\"")),
  32                 validate.parse_json(),
  33                 {"url": str},
  34                 validate.get("url")
  35             ))
  36         except PluginError:
  37             return
  38 
  39         data_url = urljoin(self.url, data_url)
  40         log.debug(f"Player URL: '{data_url}'")
  41 
  42         self.title, media = self.session.http.get(data_url, schema=validate.Schema(
  43             validate.parse_json(name="MEDIAINFO"),
  44             {"mc": {
  45                 validate.optional("_title"): str,
  46                 "_mediaArray": [validate.all(
  47                     {
  48                         "_mediaStreamArray": [validate.all(
  49                             {
  50                                 "_quality": validate.any(str, int),
  51                                 "_stream": [validate.url()],
  52                             },
  53                             validate.union_get("_quality", ("_stream", 0))
  54                         )]
  55                     },
  56                     validate.get("_mediaStreamArray"),
  57                     validate.transform(dict)
  58                 )]
  59             }},
  60             validate.get("mc"),
  61             validate.union_get("_title", ("_mediaArray", 0))
  62         ))
  63 
  64         if media.get("auto"):
  65             yield from HLSStream.parse_variant_playlist(self.session, media.get("auto")).items()
  66         else:
  67             for quality, stream in media.items():
  68                 yield self._QUALITY_MAP.get(quality, quality), HTTPStream(self.session, stream)
  69 
  70 
  71 __plugin__ = ARDLive
  72
  ```
  --- 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/ard_live.py b/src/streamlink/plugins/ard_live.py
  --- a/src/streamlink/plugins/ard_live.py
  +++ b/src/streamlink/plugins/ard_live.py
  @@ -14,6 +14,7 @@
       r"https?://((www|live)\.)?daserste\.de/"
   ))
   class ARDLive(Plugin):
  +    _URL_DATA_BASE = "https://www.daserste.de/"
       _QUALITY_MAP = {
           4: "1080p",
           3: "720p",
  @@ -36,7 +37,7 @@
           except PluginError:
               return
   
  -        data_url = urljoin(self.url, data_url)
  +        data_url = urljoin(self._URL_DATA_BASE, data_url)
           log.debug(f"Player URL: '{data_url}'")
   
           self.title, media = self.session.http.get(data_url, schema=validate.Schema(
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/ard_live.py b/src/streamlink/plugins/ard_live.py\n--- a/src/streamlink/plugins/ard_live.py\n+++ b/src/streamlink/plugins/ard_live.py\n@@ -14,6 +14,7 @@\n     r\"https?://((www|live)\\.)?daserste\\.de/\"\n ))\n class ARDLive(Plugin):\n+    _URL_DATA_BASE = \"https://www.daserste.de/\"\n     _QUALITY_MAP = {\n         4: \"1080p\",\n         3: \"720p\",\n@@ -36,7 +37,7 @@\n         except PluginError:\n             return\n \n-        data_url = urljoin(self.url, data_url)\n+        data_url = urljoin(self._URL_DATA_BASE, data_url)\n         log.debug(f\"Player URL: '{data_url}'\")\n \n         self.title, media = self.session.http.get(data_url, schema=validate.Schema(\n", "issue": "plugins.ard_live: Unable to parse MEDIAINFO\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\nOn streamlink 3.1.1 Linux:\r\n\r\n```\r\n[cli][info] Found matching plugin ard_live for URL https://live.daserste.de/\r\nerror: Unable to validate response text: Unable to parse MEDIAINFO: Expecting value: line 1 column 1 (char 0) ('<!DOCTYPE HTML>\\n<html lang=\"de\" i ...)\r\n```\r\n\r\nStreamlink 2.0.0 Windows works fine. Can't find a working 2.0.0 Linux build to verify.\r\n\r\n3.1.1 seems to expect a player url at `https://live.daserste.de/live-de-102~playerJson.json` and 2.0.0 at `https://www.daserste.de/live/live-de-102~playerJson.json`.\r\n\r\nIs there a commandline arg to override it?\n\n### Debug log\n\n```text\n[cli][debug] OS:         Linux-5.15.2-arch1-1-x86_64-with-glibc2.35\r\n[cli][debug] Python:     3.10.2\r\n[cli][debug] Streamlink: 3.1.1\r\n[cli][debug] Requests(2.27.0), Socks(1.7.1), Websocket(1.2.3)\r\n[cli][debug] Arguments:\r\n[cli][debug]  url=https://live.daserste.de/\r\n[cli][debug]  --loglevel=debug\r\n[cli][info] Found matching plugin ard_live for URL https://live.daserste.de/\r\n[plugins.ard_live][debug] Player URL: 'https://live.daserste.de/live-de-102~playerJson.json'\r\nerror: Unable to validate response text: Unable to parse MEDIAINFO: Expecting value: line 1 column 1 (char 0) ('<!DOCTYPE HTML>\\n<html lang=\"de\" i ...)\n```\n\n", "before_files": [{"content": "import logging\nimport re\nfrom urllib.parse import urljoin\n\nfrom streamlink.plugin import Plugin, PluginError, pluginmatcher\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream.hls import HLSStream\nfrom streamlink.stream.http import HTTPStream\n\nlog = logging.getLogger(__name__)\n\n\n@pluginmatcher(re.compile(\n    r\"https?://((www|live)\\.)?daserste\\.de/\"\n))\nclass ARDLive(Plugin):\n    _QUALITY_MAP = {\n        4: \"1080p\",\n        3: \"720p\",\n        2: \"540p\",\n        1: \"270p\",\n        0: \"180p\"\n    }\n\n    def _get_streams(self):\n        try:\n            data_url = self.session.http.get(self.url, schema=validate.Schema(\n                validate.parse_html(),\n                validate.xml_find(\".//*[@data-ctrl-player]\"),\n                validate.get(\"data-ctrl-player\"),\n                validate.transform(lambda s: s.replace(\"'\", \"\\\"\")),\n                validate.parse_json(),\n                {\"url\": str},\n                validate.get(\"url\")\n            ))\n        except PluginError:\n            return\n\n        data_url = urljoin(self.url, data_url)\n        log.debug(f\"Player URL: '{data_url}'\")\n\n        self.title, media = self.session.http.get(data_url, schema=validate.Schema(\n            validate.parse_json(name=\"MEDIAINFO\"),\n            {\"mc\": {\n                validate.optional(\"_title\"): str,\n                \"_mediaArray\": [validate.all(\n                    {\n                        \"_mediaStreamArray\": [validate.all(\n                            {\n                                \"_quality\": validate.any(str, int),\n                                \"_stream\": [validate.url()],\n                            },\n                            validate.union_get(\"_quality\", (\"_stream\", 0))\n                        )]\n                    },\n                    validate.get(\"_mediaStreamArray\"),\n                    validate.transform(dict)\n                )]\n            }},\n            validate.get(\"mc\"),\n            validate.union_get(\"_title\", (\"_mediaArray\", 0))\n        ))\n\n        if media.get(\"auto\"):\n            yield from HLSStream.parse_variant_playlist(self.session, media.get(\"auto\")).items()\n        else:\n            for quality, stream in media.items():\n                yield self._QUALITY_MAP.get(quality, quality), HTTPStream(self.session, stream)\n\n\n__plugin__ = ARDLive\n", "path": "src/streamlink/plugins/ard_live.py"}], "after_files": [{"content": "import logging\nimport re\nfrom urllib.parse import urljoin\n\nfrom streamlink.plugin import Plugin, PluginError, pluginmatcher\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream.hls import HLSStream\nfrom streamlink.stream.http import HTTPStream\n\nlog = logging.getLogger(__name__)\n\n\n@pluginmatcher(re.compile(\n    r\"https?://((www|live)\\.)?daserste\\.de/\"\n))\nclass ARDLive(Plugin):\n    _URL_DATA_BASE = \"https://www.daserste.de/\"\n    _QUALITY_MAP = {\n        4: \"1080p\",\n        3: \"720p\",\n        2: \"540p\",\n        1: \"270p\",\n        0: \"180p\"\n    }\n\n    def _get_streams(self):\n        try:\n            data_url = self.session.http.get(self.url, schema=validate.Schema(\n                validate.parse_html(),\n                validate.xml_find(\".//*[@data-ctrl-player]\"),\n                validate.get(\"data-ctrl-player\"),\n                validate.transform(lambda s: s.replace(\"'\", \"\\\"\")),\n                validate.parse_json(),\n                {\"url\": str},\n                validate.get(\"url\")\n            ))\n        except PluginError:\n            return\n\n        data_url = urljoin(self._URL_DATA_BASE, data_url)\n        log.debug(f\"Player URL: '{data_url}'\")\n\n        self.title, media = self.session.http.get(data_url, schema=validate.Schema(\n            validate.parse_json(name=\"MEDIAINFO\"),\n            {\"mc\": {\n                validate.optional(\"_title\"): str,\n                \"_mediaArray\": [validate.all(\n                    {\n                        \"_mediaStreamArray\": [validate.all(\n                            {\n                                \"_quality\": validate.any(str, int),\n                                \"_stream\": [validate.url()],\n                            },\n                            validate.union_get(\"_quality\", (\"_stream\", 0))\n                        )]\n                    },\n                    validate.get(\"_mediaStreamArray\"),\n                    validate.transform(dict)\n                )]\n            }},\n            validate.get(\"mc\"),\n            validate.union_get(\"_title\", (\"_mediaArray\", 0))\n        ))\n\n        if media.get(\"auto\"):\n            yield from HLSStream.parse_variant_playlist(self.session, media.get(\"auto\")).items()\n        else:\n            for quality, stream in media.items():\n                yield self._QUALITY_MAP.get(quality, quality), HTTPStream(self.session, stream)\n\n\n__plugin__ = ARDLive\n", "path": "src/streamlink/plugins/ard_live.py"}]}