Repository: streamlink/streamlink
Pull request #3484 (2021-01-10 14:57:22)

plugins.turkuvaz: add channels and URL tests
- atv.com.tr/a2tv/canli-yayin
- ahaber.com.tr/video/canli-yayin

closes  #3475



Patch:
diff --git a/docs/plugin_matrix.rst b/docs/plugin_matrix.rst
index 788c0f6e..dab3cbb9 100644
--- a/docs/plugin_matrix.rst
+++ b/docs/plugin_matrix.rst
@@ -64,10 +64,9 @@ dogan                   - cnnturk.com        Yes   Yes
                         - dreamtv.com.tr
                         - kanald.com.tr
                         - teve2.com.tr
-dogus                   - ntvspor.net        Yes   No
+dogus                   - eurostartv.com.tr  Yes   No
                         - kralmuzik.com.tr
                         - ntv.com.tr
-                        - eurostartv.com.tr
                         - startv.com.tr
 dommune                 dommune.com          Yes   --
 drdk                    dr.dk                Yes   No    Streams may be geo-restricted to Denmark.
diff --git a/src/streamlink/plugins/dogus.py b/src/streamlink/plugins/dogus.py
index 38cbff3d..2175abe1 100644
--- a/src/streamlink/plugins/dogus.py
+++ b/src/streamlink/plugins/dogus.py
@@ -12,16 +12,15 @@ log = logging.getLogger(__name__)
 
 class Dogus(Plugin):
     """
-    Support for live streams from Dogus sites include ntv, ntvspor, and kralmuzik
+    Support for live streams from Dogus sites include ntv, and kralmuzik
     """
 
-    url_re = re.compile(r"""https?://(?:www.)?
+    url_re = re.compile(r"""https?://(?:www\.)?
         (?:
-            ntv.com.tr/canli-yayin/ntv|
-            ntvspor.net/canli-yayin|
-            kralmuzik.com.tr/tv/|
-            eurostartv.com.tr/canli-izle|
-            startv.com.tr/canli-yayin
+            eurostartv\.com\.tr/canli-izle|
+            kralmuzik\.com\.tr/tv/|
+            ntv\.com\.tr/canli-yayin/ntv|
+            startv\.com\.tr/canli-yayin
         )/?""", re.VERBOSE)
     mobile_url_re = re.compile(r"""(?P<q>["'])(?P<url>(https?:)?//[^'"]*?/live/hls/[^'"]*?\?token=)
                                    (?P<token>[^'"]*?)(?P=q)""", re.VERBOSE)
diff --git a/src/streamlink/plugins/turkuvaz.py b/src/streamlink/plugins/turkuvaz.py
index 61cb3d04..c77f3972 100644
--- a/src/streamlink/plugins/turkuvaz.py
+++ b/src/streamlink/plugins/turkuvaz.py
@@ -20,6 +20,10 @@ class Turkuvaz(Plugin):
             |
             (atv|a2tv|ahaber|aspor|minikago|minikacocuk|anews)\.com\.tr
         )/webtv/(?:live-broadcast|canli-yayin)
+    |
+        (ahaber)\.com\.tr/video/canli-yayin
+    |
+        atv\.com\.tr/(a2tv)/canli-yayin
     |
         sabah\.com\.tr/(apara)/canli-yayin
     )""")
@@ -39,7 +43,7 @@ class Turkuvaz(Plugin):
 
     def _get_streams(self):
         url_m = self._url_re.match(self.url)
-        domain = url_m.group(1) or url_m.group(2) or url_m.group(3)
+        domain = url_m.group(1) or url_m.group(2) or url_m.group(3) or url_m.group(4) or url_m.group(5)
         # remap the domain to channel
         channel = {"atv": "atvhd",
                    "ahaber": "ahaberhd",


Test patch:
diff --git a/tests/plugins/test_dogus.py b/tests/plugins/test_dogus.py
index dee4e16f..b4484114 100644
--- a/tests/plugins/test_dogus.py
+++ b/tests/plugins/test_dogus.py
@@ -6,8 +6,9 @@ from streamlink.plugins.dogus import Dogus
 class TestPluginDogus(unittest.TestCase):
     def test_can_handle_url(self):
         should_match = [
-            'http://www.ntvspor.net/canli-yayin',
             'http://eurostartv.com.tr/canli-izle',
+            'http://kralmuzik.com.tr/tv/',
+            'http://ntv.com.tr/canli-yayin/ntv',
             'http://startv.com.tr/canli-yayin',
         ]
         for url in should_match:
@@ -16,6 +17,7 @@ class TestPluginDogus(unittest.TestCase):
     def test_can_handle_url_negative(self):
         should_not_match = [
             'https://example.com/index.html',
+            'http://www.ntvspor.net/canli-yayin',
         ]
         for url in should_not_match:
             self.assertFalse(Dogus.can_handle_url(url))
diff --git a/tests/plugins/test_turkuvaz.py b/tests/plugins/test_turkuvaz.py
index 8098cb04..f7e2ee35 100644
--- a/tests/plugins/test_turkuvaz.py
+++ b/tests/plugins/test_turkuvaz.py
@@ -6,8 +6,12 @@ from streamlink.plugins.turkuvaz import Turkuvaz
 class TestPluginTurkuvaz(unittest.TestCase):
     def test_can_handle_url(self):
         should_match = [
+            'http://www.atv.com.tr/a2tv/canli-yayin',
+            'https://www.atv.com.tr/a2tv/canli-yayin',
             'https://www.atv.com.tr/webtv/canli-yayin',
             'http://www.a2tv.com.tr/webtv/canli-yayin',
+            'http://www.ahaber.com.tr/video/canli-yayin',
+            'https://www.ahaber.com.tr/video/canli-yayin',
             'https://www.ahaber.com.tr/webtv/canli-yayin',
             'https://www.aspor.com.tr/webtv/canli-yayin',
             'http://www.anews.com.tr/webtv/live-broadcast',