prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [bug] CDNBG - multiple issues
  ## Bug Report
  1. BITelevision should be removed from the plugin and/or wiki/info pages, as it no longer exists.
  2. Inlife.bg shouldn't be listed as supported under CDNbg.
  3. Tvbulgare.bg should be listed as supported in inlife.bg's place (latter shares the former's stream)
  4. Mu-vi.tv gives an error.
  5. CDNBG should cover VTK - the national military channel
  6. Kanal3's livestream is not found.
  7. CDNBG should cover Cherno More - the regional channel for Varna, Bulgaria.
  
  ### Reproduction steps / Explicit stream URLs to test
  1. https://bitelevision.com/ is not a thing anymore.
  2. Inlife.bg can't be opened and shouldn't be listed - it is a 'media partner' that restreams https://tvbulgare.bg/, which could be put in as a replacement for it.
  3. https://tvbulgare.bg/ - No playable streams found.
  4. http://mu-vi.tv/LiveStreams/pages/Live.aspx - Error: Unable to open URL.
  5. https://www.armymedia.bg/
  6. https://kanal3.bg/live
  7. https://www.chernomore.bg/
  
  --- 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/cdnbg.py`
  Content:
  ```
  1 import logging
  2 import re
  3 
  4 from streamlink.compat import urlparse
  5 from streamlink.plugin import Plugin
  6 from streamlink.plugin.api import useragents
  7 from streamlink.plugin.api import validate
  8 from streamlink.stream import HLSStream
  9 from streamlink.utils import update_scheme
  10 
  11 log = logging.getLogger(__name__)
  12 
  13 
  14 class CDNBG(Plugin):
  15     url_re = re.compile(r"""
  16         https?://(?:www\.)?(?:
  17             tv\.bnt\.bg/\w+(?:/\w+)?|
  18             bitelevision\.com/live|
  19             nova\.bg/live|
  20             kanal3\.bg/live|
  21             bgonair\.bg/tvonline|
  22             inlife\.bg|
  23             mmtvmusic\.com/live|
  24             mu-vi\.tv/LiveStreams/pages/Live\.aspx|
  25             videochanel\.bstv\.bg|
  26             live\.bstv\.bg|
  27             bloombergtv.bg/video
  28         )/?
  29     """, re.VERBOSE)
  30     iframe_re = re.compile(r"iframe .*?src=\"((?:https?(?::|&#58;))?//(?:\w+\.)?cdn.bg/live[^\"]+)\"", re.DOTALL)
  31     sdata_re = re.compile(r"sdata\.src.*?=.*?(?P<q>[\"'])(?P<url>http.*?)(?P=q)")
  32     hls_file_re = re.compile(r"(src|file): (?P<q>[\"'])(?P<url>(https?:)?//.+?m3u8.*?)(?P=q)")
  33     hls_src_re = re.compile(r"video src=(?P<url>http[^ ]+m3u8[^ ]*)")
  34 
  35     stream_schema = validate.Schema(
  36         validate.any(
  37             validate.all(validate.transform(sdata_re.search), validate.get("url")),
  38             validate.all(validate.transform(hls_file_re.search), validate.get("url")),
  39             validate.all(validate.transform(hls_src_re.search), validate.get("url")),
  40         )
  41     )
  42 
  43     @classmethod
  44     def can_handle_url(cls, url):
  45         return cls.url_re.match(url) is not None
  46 
  47     def find_iframe(self, res):
  48         p = urlparse(self.url)
  49         for url in self.iframe_re.findall(res.text):
  50             if "googletagmanager" not in url:
  51                 url = url.replace("&#58;", ":")
  52                 if url.startswith("//"):
  53                     return "{0}:{1}".format(p.scheme, url)
  54                 else:
  55                     return url
  56 
  57     def _get_streams(self):
  58         self.session.http.headers.update({"User-Agent": useragents.CHROME})
  59         res = self.session.http.get(self.url)
  60         iframe_url = self.find_iframe(res)
  61 
  62         if iframe_url:
  63             log.debug("Found iframe: {0}", iframe_url)
  64             res = self.session.http.get(iframe_url, headers={"Referer": self.url})
  65             stream_url = update_scheme(self.url, self.stream_schema.validate(res.text))
  66             log.warning("SSL Verification disabled.")
  67             return HLSStream.parse_variant_playlist(self.session,
  68                                                     stream_url,
  69                                                     verify=False)
  70 
  71 
  72 __plugin__ = CDNBG
  73
  ```
  --- 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/cdnbg.py b/src/streamlink/plugins/cdnbg.py
  --- a/src/streamlink/plugins/cdnbg.py
  +++ b/src/streamlink/plugins/cdnbg.py
  @@ -15,16 +15,15 @@
       url_re = re.compile(r"""
           https?://(?:www\.)?(?:
               tv\.bnt\.bg/\w+(?:/\w+)?|
  -            bitelevision\.com/live|
               nova\.bg/live|
  -            kanal3\.bg/live|
               bgonair\.bg/tvonline|
  -            inlife\.bg|
               mmtvmusic\.com/live|
               mu-vi\.tv/LiveStreams/pages/Live\.aspx|
  -            videochanel\.bstv\.bg|
               live\.bstv\.bg|
  -            bloombergtv.bg/video
  +            bloombergtv.bg/video|
  +            armymedia.bg|
  +            chernomore.bg|
  +            i.cdn.bg/live/
           )/?
       """, re.VERBOSE)
       iframe_re = re.compile(r"iframe .*?src=\"((?:https?(?::|&#58;))?//(?:\w+\.)?cdn.bg/live[^\"]+)\"", re.DOTALL)
  @@ -44,23 +43,26 @@
       def can_handle_url(cls, url):
           return cls.url_re.match(url) is not None
   
  -    def find_iframe(self, res):
  -        p = urlparse(self.url)
  -        for url in self.iframe_re.findall(res.text):
  -            if "googletagmanager" not in url:
  -                url = url.replace("&#58;", ":")
  -                if url.startswith("//"):
  -                    return "{0}:{1}".format(p.scheme, url)
  +    def find_iframe(self, url):
  +        self.session.http.headers.update({"User-Agent": useragents.CHROME})
  +        res = self.session.http.get(self.url)
  +        p = urlparse(url)
  +        for iframe_url in self.iframe_re.findall(res.text):
  +            if "googletagmanager" not in iframe_url:
  +                log.debug("Found iframe: {0}", iframe_url)
  +                iframe_url = iframe_url.replace("&#58;", ":")
  +                if iframe_url.startswith("//"):
  +                    return "{0}:{1}".format(p.scheme, iframe_url)
                   else:
  -                    return url
  +                    return iframe_url
   
       def _get_streams(self):
  -        self.session.http.headers.update({"User-Agent": useragents.CHROME})
  -        res = self.session.http.get(self.url)
  -        iframe_url = self.find_iframe(res)
  +        if "i.cdn.bg/live/" in self.url:
  +            iframe_url = self.url
  +        else:
  +            iframe_url = self.find_iframe(self.url)
   
           if iframe_url:
  -            log.debug("Found iframe: {0}", iframe_url)
               res = self.session.http.get(iframe_url, headers={"Referer": self.url})
               stream_url = update_scheme(self.url, self.stream_schema.validate(res.text))
               log.warning("SSL Verification disabled.")
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/cdnbg.py b/src/streamlink/plugins/cdnbg.py\n--- a/src/streamlink/plugins/cdnbg.py\n+++ b/src/streamlink/plugins/cdnbg.py\n@@ -15,16 +15,15 @@\n     url_re = re.compile(r\"\"\"\n         https?://(?:www\\.)?(?:\n             tv\\.bnt\\.bg/\\w+(?:/\\w+)?|\n-            bitelevision\\.com/live|\n             nova\\.bg/live|\n-            kanal3\\.bg/live|\n             bgonair\\.bg/tvonline|\n-            inlife\\.bg|\n             mmtvmusic\\.com/live|\n             mu-vi\\.tv/LiveStreams/pages/Live\\.aspx|\n-            videochanel\\.bstv\\.bg|\n             live\\.bstv\\.bg|\n-            bloombergtv.bg/video\n+            bloombergtv.bg/video|\n+            armymedia.bg|\n+            chernomore.bg|\n+            i.cdn.bg/live/\n         )/?\n     \"\"\", re.VERBOSE)\n     iframe_re = re.compile(r\"iframe .*?src=\\\"((?:https?(?::|&#58;))?//(?:\\w+\\.)?cdn.bg/live[^\\\"]+)\\\"\", re.DOTALL)\n@@ -44,23 +43,26 @@\n     def can_handle_url(cls, url):\n         return cls.url_re.match(url) is not None\n \n-    def find_iframe(self, res):\n-        p = urlparse(self.url)\n-        for url in self.iframe_re.findall(res.text):\n-            if \"googletagmanager\" not in url:\n-                url = url.replace(\"&#58;\", \":\")\n-                if url.startswith(\"//\"):\n-                    return \"{0}:{1}\".format(p.scheme, url)\n+    def find_iframe(self, url):\n+        self.session.http.headers.update({\"User-Agent\": useragents.CHROME})\n+        res = self.session.http.get(self.url)\n+        p = urlparse(url)\n+        for iframe_url in self.iframe_re.findall(res.text):\n+            if \"googletagmanager\" not in iframe_url:\n+                log.debug(\"Found iframe: {0}\", iframe_url)\n+                iframe_url = iframe_url.replace(\"&#58;\", \":\")\n+                if iframe_url.startswith(\"//\"):\n+                    return \"{0}:{1}\".format(p.scheme, iframe_url)\n                 else:\n-                    return url\n+                    return iframe_url\n \n     def _get_streams(self):\n-        self.session.http.headers.update({\"User-Agent\": useragents.CHROME})\n-        res = self.session.http.get(self.url)\n-        iframe_url = self.find_iframe(res)\n+        if \"i.cdn.bg/live/\" in self.url:\n+            iframe_url = self.url\n+        else:\n+            iframe_url = self.find_iframe(self.url)\n \n         if iframe_url:\n-            log.debug(\"Found iframe: {0}\", iframe_url)\n             res = self.session.http.get(iframe_url, headers={\"Referer\": self.url})\n             stream_url = update_scheme(self.url, self.stream_schema.validate(res.text))\n             log.warning(\"SSL Verification disabled.\")\n", "issue": "[bug] CDNBG - multiple issues\n## Bug Report\r\n1. BITelevision should be removed from the plugin and/or wiki/info pages, as it no longer exists.\r\n2. Inlife.bg shouldn't be listed as supported under CDNbg.\r\n3. Tvbulgare.bg should be listed as supported in inlife.bg's place (latter shares the former's stream)\r\n4. Mu-vi.tv gives an error.\r\n5. CDNBG should cover VTK - the national military channel\r\n6. Kanal3's livestream is not found.\r\n7. CDNBG should cover Cherno More - the regional channel for Varna, Bulgaria.\r\n\r\n### Reproduction steps / Explicit stream URLs to test\r\n1. https://bitelevision.com/ is not a thing anymore.\r\n2. Inlife.bg can't be opened and shouldn't be listed - it is a 'media partner' that restreams https://tvbulgare.bg/, which could be put in as a replacement for it.\r\n3. https://tvbulgare.bg/ - No playable streams found.\r\n4. http://mu-vi.tv/LiveStreams/pages/Live.aspx - Error: Unable to open URL.\r\n5. https://www.armymedia.bg/\r\n6. https://kanal3.bg/live\r\n7. https://www.chernomore.bg/\n", "before_files": [{"content": "import logging\nimport re\n\nfrom streamlink.compat import urlparse\nfrom streamlink.plugin import Plugin\nfrom streamlink.plugin.api import useragents\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream import HLSStream\nfrom streamlink.utils import update_scheme\n\nlog = logging.getLogger(__name__)\n\n\nclass CDNBG(Plugin):\n    url_re = re.compile(r\"\"\"\n        https?://(?:www\\.)?(?:\n            tv\\.bnt\\.bg/\\w+(?:/\\w+)?|\n            bitelevision\\.com/live|\n            nova\\.bg/live|\n            kanal3\\.bg/live|\n            bgonair\\.bg/tvonline|\n            inlife\\.bg|\n            mmtvmusic\\.com/live|\n            mu-vi\\.tv/LiveStreams/pages/Live\\.aspx|\n            videochanel\\.bstv\\.bg|\n            live\\.bstv\\.bg|\n            bloombergtv.bg/video\n        )/?\n    \"\"\", re.VERBOSE)\n    iframe_re = re.compile(r\"iframe .*?src=\\\"((?:https?(?::|&#58;))?//(?:\\w+\\.)?cdn.bg/live[^\\\"]+)\\\"\", re.DOTALL)\n    sdata_re = re.compile(r\"sdata\\.src.*?=.*?(?P<q>[\\\"'])(?P<url>http.*?)(?P=q)\")\n    hls_file_re = re.compile(r\"(src|file): (?P<q>[\\\"'])(?P<url>(https?:)?//.+?m3u8.*?)(?P=q)\")\n    hls_src_re = re.compile(r\"video src=(?P<url>http[^ ]+m3u8[^ ]*)\")\n\n    stream_schema = validate.Schema(\n        validate.any(\n            validate.all(validate.transform(sdata_re.search), validate.get(\"url\")),\n            validate.all(validate.transform(hls_file_re.search), validate.get(\"url\")),\n            validate.all(validate.transform(hls_src_re.search), validate.get(\"url\")),\n        )\n    )\n\n    @classmethod\n    def can_handle_url(cls, url):\n        return cls.url_re.match(url) is not None\n\n    def find_iframe(self, res):\n        p = urlparse(self.url)\n        for url in self.iframe_re.findall(res.text):\n            if \"googletagmanager\" not in url:\n                url = url.replace(\"&#58;\", \":\")\n                if url.startswith(\"//\"):\n                    return \"{0}:{1}\".format(p.scheme, url)\n                else:\n                    return url\n\n    def _get_streams(self):\n        self.session.http.headers.update({\"User-Agent\": useragents.CHROME})\n        res = self.session.http.get(self.url)\n        iframe_url = self.find_iframe(res)\n\n        if iframe_url:\n            log.debug(\"Found iframe: {0}\", iframe_url)\n            res = self.session.http.get(iframe_url, headers={\"Referer\": self.url})\n            stream_url = update_scheme(self.url, self.stream_schema.validate(res.text))\n            log.warning(\"SSL Verification disabled.\")\n            return HLSStream.parse_variant_playlist(self.session,\n                                                    stream_url,\n                                                    verify=False)\n\n\n__plugin__ = CDNBG\n", "path": "src/streamlink/plugins/cdnbg.py"}], "after_files": [{"content": "import logging\nimport re\n\nfrom streamlink.compat import urlparse\nfrom streamlink.plugin import Plugin\nfrom streamlink.plugin.api import useragents\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream import HLSStream\nfrom streamlink.utils import update_scheme\n\nlog = logging.getLogger(__name__)\n\n\nclass CDNBG(Plugin):\n    url_re = re.compile(r\"\"\"\n        https?://(?:www\\.)?(?:\n            tv\\.bnt\\.bg/\\w+(?:/\\w+)?|\n            nova\\.bg/live|\n            bgonair\\.bg/tvonline|\n            mmtvmusic\\.com/live|\n            mu-vi\\.tv/LiveStreams/pages/Live\\.aspx|\n            live\\.bstv\\.bg|\n            bloombergtv.bg/video|\n            armymedia.bg|\n            chernomore.bg|\n            i.cdn.bg/live/\n        )/?\n    \"\"\", re.VERBOSE)\n    iframe_re = re.compile(r\"iframe .*?src=\\\"((?:https?(?::|&#58;))?//(?:\\w+\\.)?cdn.bg/live[^\\\"]+)\\\"\", re.DOTALL)\n    sdata_re = re.compile(r\"sdata\\.src.*?=.*?(?P<q>[\\\"'])(?P<url>http.*?)(?P=q)\")\n    hls_file_re = re.compile(r\"(src|file): (?P<q>[\\\"'])(?P<url>(https?:)?//.+?m3u8.*?)(?P=q)\")\n    hls_src_re = re.compile(r\"video src=(?P<url>http[^ ]+m3u8[^ ]*)\")\n\n    stream_schema = validate.Schema(\n        validate.any(\n            validate.all(validate.transform(sdata_re.search), validate.get(\"url\")),\n            validate.all(validate.transform(hls_file_re.search), validate.get(\"url\")),\n            validate.all(validate.transform(hls_src_re.search), validate.get(\"url\")),\n        )\n    )\n\n    @classmethod\n    def can_handle_url(cls, url):\n        return cls.url_re.match(url) is not None\n\n    def find_iframe(self, url):\n        self.session.http.headers.update({\"User-Agent\": useragents.CHROME})\n        res = self.session.http.get(self.url)\n        p = urlparse(url)\n        for iframe_url in self.iframe_re.findall(res.text):\n            if \"googletagmanager\" not in iframe_url:\n                log.debug(\"Found iframe: {0}\", iframe_url)\n                iframe_url = iframe_url.replace(\"&#58;\", \":\")\n                if iframe_url.startswith(\"//\"):\n                    return \"{0}:{1}\".format(p.scheme, iframe_url)\n                else:\n                    return iframe_url\n\n    def _get_streams(self):\n        if \"i.cdn.bg/live/\" in self.url:\n            iframe_url = self.url\n        else:\n            iframe_url = self.find_iframe(self.url)\n\n        if iframe_url:\n            res = self.session.http.get(iframe_url, headers={\"Referer\": self.url})\n            stream_url = update_scheme(self.url, self.stream_schema.validate(res.text))\n            log.warning(\"SSL Verification disabled.\")\n            return HLSStream.parse_variant_playlist(self.session,\n                                                    stream_url,\n                                                    verify=False)\n\n\n__plugin__ = CDNBG\n", "path": "src/streamlink/plugins/cdnbg.py"}]}