Repository: streamlink/streamlink

Issue:
TV1 Plugin - new player being used

## Bug Report
- [x] This is a bug report and I have read the contribution guidelines.


### Description
 TV1 won't start, because they're using a different player now.


### Expected / Actual behavior

Should have worked?


### Reproduction steps / Explicit stream URLs to test


1. streamlink http://tv1channel.org/ best
2. ? ? ?
3. profit

Discussion:

Patch:
diff --git a/docs/plugin_matrix.rst b/docs/plugin_matrix.rst
index 484121c1..7021b5cb 100644
--- a/docs/plugin_matrix.rst
+++ b/docs/plugin_matrix.rst
@@ -223,7 +223,7 @@ turkuvaz                - atv.com.tr         Yes   No
                         - minikacocuk.com.tr
                         - minikago.com.tr
                         - sabah.com.tr
-tv1channel              tv1channel.org       Yes   Yes
+tv1channel              tv1channel.org       Yes   No
 tv3cat                  tv3.cat              Yes   Yes   Streams may be geo-restricted to Spain.
 tv4play                 - tv4play.se         Yes   Yes   Streams may be geo-restricted to Sweden.
                                                          Only non-premium streams currently supported.
diff --git a/src/streamlink/plugins/tv1channel.py b/src/streamlink/plugins/tv1channel.py
index cc38ecb0..359107b9 100644
--- a/src/streamlink/plugins/tv1channel.py
+++ b/src/streamlink/plugins/tv1channel.py
@@ -1,25 +1,32 @@
 import re
 
 from streamlink.plugin import Plugin
-
-_url_re = re.compile(r'''https?://(www\.)?tv1channel\.org/''')
-_embed_re = re.compile(r'''<iframe.+src="([^"]+)"''')
+from streamlink.plugin.api import useragents
+from streamlink.plugin.api.utils import itertags
+from streamlink.stream import HLSStream
 
 
 class TV1Channel(Plugin):
+    _url_re = re.compile(r'https?://(?:www\.)?tv1channel\.org/(?!play/)(?:index\.php/livetv)?')
+
     @classmethod
     def can_handle_url(cls, url):
-        return _url_re.match(url)
+        return cls._url_re.match(url) is not None
 
     def _get_streams(self):
+        self.session.http.headers.update({'User-Agent': useragents.FIREFOX})
         res = self.session.http.get(self.url)
-        match = _embed_re.search(res.text)
+        for iframe in itertags(res.text, 'iframe'):
+            if 'cdn.netbadgers.com' not in iframe.attributes.get('src'):
+                continue
+
+            res = self.session.http.get(iframe.attributes.get('src'))
+            for source in itertags(res.text, 'source'):
+                if source.attributes.get('src') and source.attributes.get('src').endswith('.m3u8'):
+                    return HLSStream.parse_variant_playlist(self.session,
+                                                            source.attributes.get('src'))
 
-        if match:
-            url = match.group(1)
-            if url.startswith('//'):
-                url = 'https:{0}'.format(url)
-            return self.session.streams(url)
+            break
 
 
 __plugin__ = TV1Channel


Test patch:
diff --git a/tests/plugins/test_tv1channel.py b/tests/plugins/test_tv1channel.py
index 982c4259..dd025748 100644
--- a/tests/plugins/test_tv1channel.py
+++ b/tests/plugins/test_tv1channel.py
@@ -8,8 +8,8 @@ class TestPluginTV1Channel(unittest.TestCase):
         # should match
         self.assertTrue(TV1Channel.can_handle_url("http://tv1channel.org/"))
         self.assertTrue(TV1Channel.can_handle_url("http://tv1channel.org/index.php/livetv"))
-        self.assertTrue(TV1Channel.can_handle_url("http://www.tv1channel.org/play/video.php?id=325"))
-        self.assertTrue(TV1Channel.can_handle_url("http://www.tv1channel.org/play/video.php?id=340"))
 
         # shouldn't match
         self.assertFalse(TV1Channel.can_handle_url("https://local.local"))
+        self.assertFalse(TV1Channel.can_handle_url("http://www.tv1channel.org/play/video.php?id=325"))
+        self.assertFalse(TV1Channel.can_handle_url("http://www.tv1channel.org/play/video.php?id=340"))