Repository: streamlink/streamlink

Issue:
cdnbg can't open new BNT links
## Bug Report
- [x] This is a bug report and I have read the contribution guidelines.


### Description
There have been changes to the bnt.bg live channel links, which have made them unrecognizable by the cdnbg plugin.
**Note:** Streamlink can still open these links, which are now hidden away in a small part of the website and are not protected by an SSL certificate:
```
http://tv.bnt.bg/bnt1
http://tv.bnt.bg/bnt2
http://tv.bnt.bg/bnt3
http://tv.bnt.bg/bnt4
```

**Other plugin issues:**
1. https://mmtvmusic.com/live/ has moved away to another service provider and hence can be deleted from cdnbg. Can't be opened with anything else atm.
2. https://chernomore.bg/ can be removed - the owner of the media group closed down the newspaper and television and converted the website into an information agency.
### Expected / Actual behavior
When I input them through CLI, they should open.


### Reproduction steps / Explicit stream URLs to test
```
streamlink https://bnt.bg/live best
streamlink https://bnt.bg/live/bnt1 best
streamlink https://bnt.bg/live/bnt2 best
streamlink https://bnt.bg/live/bnt3 best
streamlink https://bnt.bg/live/bnt4 best
```


### Log output
```
C:\Users\XXXX> streamlink https://bnt.bg/live/bnt1 best --loglevel debug
[cli][debug] OS:             Windows 7
[cli][debug] Python:       3.6.6
[cli][debug] Streamlink:  1.6.0
[cli][debug] Requests(2.24.0), Socks(1.7.1), Websocket(0.57.0)
error: No plugin can handle URL: https://bnt.bg/live/bnt1
```

Discussion:

Patch:
diff --git a/docs/plugin_matrix.rst b/docs/plugin_matrix.rst
index 08eb88bc..5ea6077b 100644
--- a/docs/plugin_matrix.rst
+++ b/docs/plugin_matrix.rst
@@ -39,15 +39,14 @@ brightcove              players.brig... [6]_ Yes   Yes
 btsports                sport.bt.com         Yes   Yes   Requires subscription account
 btv                     btvplus.bg           Yes   No    Streams are geo-restricted to Bulgaria.
 canalplus               mycanal.fr           No    Yes   Streams may be geo-restricted to France.
-cdnbg                   - tv.bnt.bg          Yes   No    Streams may be geo-restricted to Bulgaria.
+cdnbg                   - armymedia.bg       Yes   No    Streams may be geo-restricted to Bulgaria
                         - bgonair.bg
                         - bloombergtv.bg
-                        - mmtvmusic.com
-                        - mu-vi.tv
-                        - nova.bg
-                        - armymedia.bg
-                        - chernomore.bg
+                        - bnt.bg
+                        - live.bstv.bg
                         - i.cdn.bg
+                        - nova.bg
+                        - mu-vi.tv
 ceskatelevize           ceskatelevize.cz     Yes   Yes   Streams may be geo-restricted to Czechia.
 cinergroup              - showtv.com.tr      Yes   No
                         - haberturk.com
diff --git a/src/streamlink/plugins/cdnbg.py b/src/streamlink/plugins/cdnbg.py
index 145af3a7..49d8e2c7 100644
--- a/src/streamlink/plugins/cdnbg.py
+++ b/src/streamlink/plugins/cdnbg.py
@@ -14,16 +14,14 @@ log = logging.getLogger(__name__)
 class CDNBG(Plugin):
     url_re = re.compile(r"""
         https?://(?:www\.)?(?:
-            tv\.bnt\.bg/\w+(?:/\w+)?|
-            nova\.bg/live|
+            armymedia\.bg|
             bgonair\.bg/tvonline|
-            mmtvmusic\.com/live|
-            mu-vi\.tv/LiveStreams/pages/Live\.aspx|
+            bloombergtv\.bg/video|
+            (?:tv\.)?bnt\.bg/\w+(?:/\w+)?|
             live\.bstv\.bg|
-            bloombergtv.bg/video|
-            armymedia.bg|
-            chernomore.bg|
-            i.cdn.bg/live/
+            i\.cdn\.bg/live/|
+            nova\.bg/live|
+            mu-vi\.tv/LiveStreams/pages/Live\.aspx
         )/?
     """, re.VERBOSE)
     iframe_re = re.compile(r"iframe .*?src=\"((?:https?(?::|&#58;))?//(?:\w+\.)?cdn.bg/live[^\"]+)\"", re.DOTALL)
@@ -52,7 +50,7 @@ class CDNBG(Plugin):
                 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)
+                    return update_scheme(p.scheme, iframe_url)
                 else:
                     return iframe_url
 


Test patch:
diff --git a/tests/plugins/test_cdnbg.py b/tests/plugins/test_cdnbg.py
index af340c6d..e0010b47 100644
--- a/tests/plugins/test_cdnbg.py
+++ b/tests/plugins/test_cdnbg.py
@@ -1,40 +1,44 @@
-import pytest
+import unittest
 
 from streamlink.plugins.cdnbg import CDNBG
 
-valid_urls = [
-    ("http://bgonair.bg/tvonline",),
-    ("http://bgonair.bg/tvonline/",),
-    ("http://www.nova.bg/live",),
-    ("http://nova.bg/live",),
-    ("http://tv.bnt.bg/bnt1",),
-    ("http://tv.bnt.bg/bnt2",),
-    ("http://tv.bnt.bg/bnt3",),
-    ("http://tv.bnt.bg/bnt4",),
-    ("https://mmtvmusic.com/live/",),
-    ("http://mu-vi.tv/LiveStreams/pages/Live.aspx",),
-    ("http://live.bstv.bg/",),
-    ("https://www.bloombergtv.bg/video",),
-    ("https://i.cdn.bg/live/xfr3453g0d",)
 
-]
-invalid_urls = [
-    ("http://www.tvcatchup.com/",),
-    ("http://www.youtube.com/",),
-    ("https://www.tvevropa.com",),
-    ("http://www.kanal3.bg/live",),
-    ("http://inlife.bg/",),
-    ("http://videochanel.bstv.bg",),
-    ("http://video.bstv.bg/",),
-    ("http://bitelevision.com/live",)
-]
+class TestPluginCDNBG(unittest.TestCase):
+    def test_can_handle_url(self):
+        should_match = [
+            'http://bgonair.bg/tvonline',
+            'http://bgonair.bg/tvonline/',
+            'http://www.nova.bg/live',
+            'http://nova.bg/live',
+            'http://bnt.bg/live',
+            'http://bnt.bg/live/bnt1',
+            'http://bnt.bg/live/bnt2',
+            'http://bnt.bg/live/bnt3',
+            'http://bnt.bg/live/bnt4',
+            'http://tv.bnt.bg/bnt1',
+            'http://tv.bnt.bg/bnt2',
+            'http://tv.bnt.bg/bnt3',
+            'http://tv.bnt.bg/bnt4',
+            'http://mu-vi.tv/LiveStreams/pages/Live.aspx',
+            'http://live.bstv.bg/',
+            'https://www.bloombergtv.bg/video',
+            'https://i.cdn.bg/live/xfr3453g0d',
+        ]
+        for url in should_match:
+            self.assertTrue(CDNBG.can_handle_url(url))
 
-
-@pytest.mark.parametrize(["url"], valid_urls)
-def test_can_handle_url(url):
-    assert CDNBG.can_handle_url(url), "url should be handled"
-
-
-@pytest.mark.parametrize(["url"], invalid_urls)
-def test_can_handle_url_negative(url):
-    assert not CDNBG.can_handle_url(url), "url should not be handled"
+    def test_can_handle_url_negative(self):
+        should_not_match = [
+            'http://www.tvcatchup.com/',
+            'http://www.youtube.com/',
+            'https://www.tvevropa.com',
+            'http://www.kanal3.bg/live',
+            'http://inlife.bg/',
+            'http://videochanel.bstv.bg',
+            'http://video.bstv.bg/',
+            'http://bitelevision.com/live',
+            'http://mmtvmusic.com/live/',
+            'http://chernomore.bg/',
+        ]
+        for url in should_not_match:
+            self.assertFalse(CDNBG.can_handle_url(url))