Repository: streamlink/streamlink

Issue:
BritTV in need of password ? 
 - [x] I have read the contribution guidelines.
 
Brit TV won't open for me any more, could it be it needs One's credentials ? 
How would that look ? --brittv-username=xxxx  --brittv-password=xxxx ?
(Tested of course).
```
C:\Users\Ordval>call streamlink.exe "http://brittv.co.uk/watch/?channel=1" best
[cli][info] Found matching plugin brittv for URL http://brittv.co.uk/watch/?channel=1
[cli][info] Waiting for streams, retrying every 1.0 second(s)
```

```
C:\Users\Ordval>call streamlink.exe  -l debug --http-header User-Agent=Chrome/54.0.2840.59 "https://brittv.co.uk/watch/?channel=1" best
[cli][debug] OS:   Windows 10
[cli][debug] Python:        3.5.2
[cli][debug] Streamlink: 0.11.0
[cli][debug] Requests(2.18.4), Socks(1.6.7), Websocket(0.47.0)
[cli][info] Found matching plugin brittv for URL https://brittv.co.uk/watch/?channel=1
[plugin.brittv][debug] Found js key: aHR0cDovL2IxYTJmODdjLmFyY2guYmx1d2FyZS50di9kYWcxLm0zdTg/c2lkPWV6ZCZjaWQ9YmJjMSZhdXRoPWMzUnBiV1U5TVRVeU5EUXlNVEEzTnlaMllXeHBaR2wwZVQwekptRm5iajB3Sm1OdmJtWTlkVEFtYzJsbmJqMDBZVEk1WVdFeE4yRmtNamswWWpWaFpqWXlaR1JpWkRnek5qZGtObUl6Wmc9PQ==
error: No playable streams found on this URL: https://brittv.co.uk/watch/?channel=1 
```
Opens on website.  The temporary:
`call streamlink.exe hls://"http://b1a2f87c.arch.bluware.tv/dag1.m3u8?sid=ezd&cid=bbc1&auth=c3RpbWU9MTUyNDQwMzQ5OCZ2YWxpZGl0eT0zJmFnbj0wJmNvbmY9dTAmc2lnbj00ZWY4NTExMjNmODBlOGU5MmVjZWE1ZWUzZDc4YzQ0Mg==" best `
will play.


Discussion:
A closing of the thread might suggest everything's been fixed, 
I uninstalled the latest (because that is what we're still supposed to do ?)  
and (re-)installed the very [streamlink-latest.exe] I could find, but it's the same thing. 
(My action not being enough ?).
Although it's been “merged”, when will we see it come into effect ?
This depends on the time the next build was scheduled. You can see all builds here:
https://travis-ci.org/streamlink/streamlink/builds
The ones tagged with [`cron`](https://en.wikipedia.org/wiki/Cron) are the ones which build the Windows installers on a daily basis. Looks like you've missed it by a couple of minutes...

You can also install Streamlink from the master branch of the git repo via pip
```bash
pip install git+https://github.com/streamlink/streamlink.git
```
or by cloning the repo and installing it manually
```bash
git clone https://github.com/streamlink/streamlink.git
cd streamlink
python setup.py install
```
https://streamlink.github.io/install.html#source-code
Luckily for me your group updates the Nightly (every day?), 
but there must still be something wrong in the script.

E4:
```
File reading failed:
VLC could not open the file "C:\Users\Ordval\Documents\Spellistor\(''," (No such file or directory).
Your input can't be opened:
VLC is unable to open the MRL 'file:///C:/Users/Ordval/Documents/Spellistor/%28%27%27%2C'. Check the log for details.
Your input can't be opened:
VLC is unable to open the MRL ''http://b1a2f87c.arch.bluware.tv/dag1.m3u8?sid=ezd&cid=e4uk&auth=c3RpbWU9MTUyNDUyNjY4MSZ2YWxpZGl0eT0zJmFnbj0wJmNvbmY9dTAmc2lnbj0wY2IzZTY2NTM2ZjY0NjE3ZDNhZTZkN2Q3ZjUxNjU4MQ==')'. Check the log for details.
Your input can't be opened:
VLC is unable to open the MRL ''http://b1a2f87c.arch.bluware.tv/dag1.m3u8?sid=ezd&cid=e4uk&auth=c3RpbWU9MTUyNDUyNjY4MSZ2YWxpZGl0eT0zJmFnbj0wJmNvbmY9dTAmc2lnbj0wY2IzZTY2NTM2ZjY0NjE3ZDNhZTZkN2Q3ZjUxNjU4MQ==')'. Check the log for details.
```
In the VLC playlist:
```
Title
('',
dag1.m3u8?sid=ezd&cid=e4uk&auth=c3RpbWU9MTUyNDUyNjY4MSZ2YWxpZGl0eT0zJmFnbj0wJmNvbmY9dTAmc2lnbj0wY2IzZTY2NTM2ZjY0NjE3ZDNhZTZkN2Q3ZjUxNjU4MQ==')
```
SMPlayer will only give an “Oops,.....”. 
cmd:
```
Please wait while loading BBC One (13, BritTv)...
[cli][info] Found matching plugin brittv for URL https://brittv.co.uk/watch/?channel=1
[cli][info] Available streams: live_alt, live (worst, best)
[cli][info] Starting player: "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
[cli][info] Got HTTP request from VLC/2.2.4 LibVLC/2.2.4
[cli][info] Opening stream: live (hls)
[cli][error] Could not open stream: Unable to open URL: ('"', 'http://b1a2f87c.arch.bluware.tv/dag1.m3u8?sid=ezd&cid=bbc1&auth=c3RpbWU9MTUyNDUyODE2MCZ2YWxpZGl0eT0zJmFnbj0wJmNvbmY9dTAmc2lnbj1lNWQzOTM1MjU5Y2M5NDIyZWIwODJlOGQzMGRkN2VmMg==') (No connection adapters were found for '('"', 'http://b1a2f87c.arch.bluware.tv/dag1.m3u8?sid=ezd&cid=bbc1&auth=c3RpbWU9MTUyNDUyODE2MCZ2YWxpZGl0eT0zJmFnbj0wJmNvbmY9dTAmc2lnbj1lNWQzOTM1MjU5Y2M5NDIyZWIwODJlOGQzMGRkN2VmMg==')')
[cli][info] Opening stream: live (hls)
```
Inserting the given temporary MRL (http://b1a2f87c...) in the VLC (stream?) field will play it for a while.

(Do we still need to completely uninstall before upgrading ? taken the pip option into account) 
(I'm always very grateful for all of your effort).
@Ordval are you using a wrapper script to launch streamlink?
@ **beardypig**  Using a "Darby_Crash" batch that loosely looks like this: 
```
@echo off
color f4
:BACK
mode con:cols=117 lines=110
title %title%  Alla Kanaler

echo	(13) = BBC 1  (67) =	 Encyclo/ Science  (121)= M 6/  Marco Polo  (175) = S4C/  la 6  it.

cls
(here missing further commands)
:13 
cls                                                                                                                                                                      
echo.
echo                                                                                                                                                                                                                                                                                     Please wait while loading BBC One (13, BritTv)... 
call streamlink.exe --http-header X-Forwarded-For=193.36.34.11 --http-header User-Agent=Chrome/54.0.2840.59  --player-continuous- --retry-streams 1 --retry-open 86400 "https://brittv.co.uk/watch/?channel=1" best  
goto BACK

:0
cls
mode con:cols=34 lines=5
echo.
echo         Til næste gang, Hver gang !
echo.
ping localhost -n 3 >nul
exit /b 
```
to launch the channels, but that was possibly not what you were asking for ?

Haven't installed the latest Nightly yet, maybe it's already been solved ?
@Ordval, please try the latest nightly, and try to launch it without a wrapper script - incase it is interfering with streamlink :)
https://github.com/streamlink/streamlink/blob/7018fc8260f47cc1cb2e7a05dee9e6e58244e5b1/src/streamlink/plugins/brittv.py#L28

https://github.com/streamlink/streamlink/blob/7018fc8260f47cc1cb2e7a05dee9e6e58244e5b1/src/streamlink/plugins/brittv.py#L13

the stream doesn't work because `findall` uses the quote group as an url

```
[cli][error] Try 1/1: Could not open stream <HLSStream('(\'"\', \'http://
```
Yerp, that's my bad ....

Resolving patch:
diff --git a/src/streamlink/plugins/brittv.py b/src/streamlink/plugins/brittv.py
--- a/src/streamlink/plugins/brittv.py
+++ b/src/streamlink/plugins/brittv.py
@@ -17,15 +17,16 @@ def can_handle_url(cls, url):
         return cls.url_re.match(url) is not None
 
     def _get_streams(self):
-        res = http.get(self.url, headers={"User-Agent": useragents.CHROME})
+        http.headers.update({"User-Agent": useragents.CHROME})
+        res = http.get(self.url)
         m = self.js_re.search(res.text)
         if m:
             self.logger.debug("Found js key: {0}", m.group(1))
             js_url = m.group(0)
-            res = http.get(urljoin(self.url, js_url))
+            res = http.get(urljoin(self.url, js_url), headers={"Referer": self.url})
 
             self.logger.debug("Looking for stream URL...")
-            for url in self.player_re.findall(res.text):
+            for _, url in self.player_re.findall(res.text):
                 if "adblock" not in url:
                     yield "live", HLSStream(self.session, url)
 


Test patch: