Repository: streamlink/streamlink

Issue:
[bug] BTV plugin needs updating
## Bug Report
- [x] This is a bug report and I have read the contribution guidelines.


### Description
The location of the BTV livestream has moved to https://btvplus.bg/live/
**Edit**: Livestreaming no longer requires a user to login, so that can be removed from the plugin info page.


### Expected / Actual behavior
Streamlink should be able to handle the link.


### Reproduction steps / Explicit stream URLs to test
1. streamlink https://btvplus.bg/live/ best 
2. error: No plugin can handle URL: https://btvplus.bg/live/


Discussion:

Resolving patch:
diff --git a/src/streamlink/plugins/btv.py b/src/streamlink/plugins/btv.py
--- a/src/streamlink/plugins/btv.py
+++ b/src/streamlink/plugins/btv.py
@@ -1,38 +1,30 @@
-from __future__ import print_function
+import argparse
+import logging
 import re
 
-from streamlink import PluginError
-from streamlink.plugin import Plugin
+from streamlink.plugin import Plugin, PluginArguments, PluginArgument
 from streamlink.plugin.api import validate
 from streamlink.stream import HLSStream
 from streamlink.utils import parse_json
-from streamlink.plugin import PluginArgument, PluginArguments
+
+log = logging.getLogger(__name__)
 
 
 class BTV(Plugin):
     arguments = PluginArguments(
         PluginArgument(
             "username",
-            metavar="USERNAME",
-            requires=["password"],
-            help="""
-        A BTV username required to access any stream.
-        """
+            help=argparse.SUPPRESS
         ),
         PluginArgument(
             "password",
             sensitive=True,
-            metavar="PASSWORD",
-            help="""
-        A BTV account password to use with --btv-username.
-        """
+            help=argparse.SUPPRESS
         )
     )
-    url_re = re.compile(r"https?://(?:www\.)?btv\.bg/live/?")
 
-    api_url = "http://www.btv.bg/lbin/global/player_config.php"
-    check_login_url = "http://www.btv.bg/lbin/userRegistration/check_user_login.php"
-    login_url = "https://www.btv.bg/bin/registration2/login.php?action=login&settings=0"
+    url_re = re.compile(r"https?://(?:www\.)?btvplus\.bg/live/?")
+    api_url = "https://btvplus.bg/lbin/v3/btvplus/player_config.php"
 
     media_id_re = re.compile(r"media_id=(\d+)")
     src_re = re.compile(r"src: \"(http.*?)\"")
@@ -55,35 +47,19 @@ class BTV(Plugin):
     def can_handle_url(cls, url):
         return cls.url_re.match(url) is not None
 
-    def login(self, username, password):
-        res = self.session.http.post(self.login_url, data={"username": username, "password": password})
-        if "success_logged_in" in res.text:
-            return True
-        else:
-            return False
-
     def get_hls_url(self, media_id):
         res = self.session.http.get(self.api_url, params=dict(media_id=media_id))
-        try:
-            return parse_json(res.text, schema=self.api_schema)
-        except PluginError:
-            return
+        return parse_json(res.text, schema=self.api_schema)
 
     def _get_streams(self):
-        if not self.options.get("username") or not self.options.get("password"):
-            self.logger.error("BTV requires registration, set the username and password"
-                              " with --btv-username and --btv-password")
-        elif self.login(self.options.get("username"), self.options.get("password")):
-            res = self.session.http.get(self.url)
-            media_match = self.media_id_re.search(res.text)
-            media_id = media_match and media_match.group(1)
-            if media_id:
-                self.logger.debug("Found media id: {0}", media_id)
-                stream_url = self.get_hls_url(media_id)
-                if stream_url:
-                    return HLSStream.parse_variant_playlist(self.session, stream_url)
-        else:
-            self.logger.error("Login failed, a valid username and password is required")
+        res = self.session.http.get(self.url)
+        media_match = self.media_id_re.search(res.text)
+        media_id = media_match and media_match.group(1)
+        if media_id:
+            log.debug("Found media id: {0}", media_id)
+            stream_url = self.get_hls_url(media_id)
+            if stream_url:
+                return HLSStream.parse_variant_playlist(self.session, stream_url)
 
 
 __plugin__ = BTV


Test patch:
diff --git a/tests/plugins/test_btv.py b/tests/plugins/test_btv.py
--- a/tests/plugins/test_btv.py
+++ b/tests/plugins/test_btv.py
@@ -6,9 +6,9 @@
 class TestPluginBTV(unittest.TestCase):
     def test_can_handle_url(self):
         # should match
-        self.assertTrue(BTV.can_handle_url("http://btv.bg/live"))
-        self.assertTrue(BTV.can_handle_url("http://btv.bg/live/"))
-        self.assertTrue(BTV.can_handle_url("http://www.btv.bg/live/"))
+        self.assertTrue(BTV.can_handle_url("http://btvplus.bg/live"))
+        self.assertTrue(BTV.can_handle_url("http://btvplus.bg/live/"))
+        self.assertTrue(BTV.can_handle_url("http://www.btvplus.bg/live/"))
 
         # shouldn't match
         self.assertFalse(BTV.can_handle_url("http://www.tvcatchup.com/"))