Repository: streamlink/streamlink

Issue:
Euronews error, unable to open URL
<!--
Thanks for reporting a bug!
USE THE TEMPLATE. Otherwise your bug report may be rejected.

First, see the contribution guidelines:
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink

Also check the list of open and closed bug reports:
https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22bug%22

Please see the text preview to avoid unnecessary formatting errors.
-->


## Bug Report

<!-- Replace [ ] with [x] in order to check the box -->
- [x] This is a bug report and I have read the contribution guidelines.


### Description

<!-- Explain the bug as thoroughly as you can. Don't leave out information which is necessary for us to reproduce and debug this issue. -->
I'm unable to open Euronews live stream.

### Expected / Actual behavior

<!-- What do you expect to happen, and what is actually happening? -->
I expect the stream to open in my media player.
Instead I get this:
```
marco@vbox-ubuntu1804:~$ streamlink http://it.euronews.com/live
[cli][info] Found matching plugin euronews for URL http://it.euronews.com/live
error: Unable to open URL: //euronews-it-p-api.hexaglobe.net/1c903a19de71387485a0f6f74d7923f5/5b8a5583/euronews/euronews-euronews-website-web-responsive-2/it/stream_info.php?format=hls (Invalid URL '//euronews-it-p-api.hexaglobe.net/1c903a19de71387485a0f6f74d7923f5/5b8a5583/euronews/euronews-euronews-website-web-responsive-2/it/stream_info.php?format=hls': No schema supplied. Perhaps you meant http:////euronews-it-p-api.hexaglobe.net/1c903a19de71387485a0f6f74d7923f5/5b8a5583/euronews/euronews-euronews-website-web-responsive-2/it/stream_info.php?format=hls?)
```

### Reproduction steps / Explicit stream URLs to test

<!-- How can we reproduce this? Please note the exact steps below using the list format supplied. If you need more steps please add them. -->

Run this command:
```
streamlink http://it.euronews.com/live
```

### Log output

<!--
TEXT LOG OUTPUT IS REQUIRED for a bug report!
Use the `--loglevel debug` parameter and avoid using parameters which suppress log output.
https://streamlink.github.io/cli.html#cmdoption-l

Make sure to **remove usernames and passwords**
You can copy the output to https://gist.github.com/ or paste it below.
-->

```
marco@vbox-ubuntu1804:~$ streamlink --loglevel debug http://it.euronews.com/live
[cli][debug] OS:         Linux-4.15.0-33-generic-x86_64-with-Ubuntu-18.04-bionic
[cli][debug] Python:     3.6.5
[cli][debug] Streamlink: 0.14.2+92.gc7bef14b
[cli][debug] Requests(2.18.4), Socks(1.6.7), Websocket(0.51.0)
[cli][info] Found matching plugin euronews for URL http://it.euronews.com/live
error: Unable to open URL: //euronews-it-p-api.hexaglobe.net/688afb391d4325cad6765c6dc61585a4/5b8a7b36/euronews/euronews-euronews-website-web-responsive-2/it/stream_info.php?format=hls (Invalid URL '//euronews-it-p-api.hexaglobe.net/688afb391d4325cad6765c6dc61585a4/5b8a7b36/euronews/euronews-euronews-website-web-responsive-2/it/stream_info.php?format=hls': No schema supplied. Perhaps you meant http:////euronews-it-p-api.hexaglobe.net/688afb391d4325cad6765c6dc61585a4/5b8a7b36/euronews/euronews-euronews-website-web-responsive-2/it/stream_info.php?format=hls?)
```


### Additional comments, screenshots, etc.
Streamlink versions tested: 0.9.0, 0.14.2 from pip, master from git
Same error with all of them.


[Love Streamlink? Please consider supporting our collective. Thanks!](https://opencollective.com/streamlink/donate)



Discussion:

Resolving patch:
diff --git a/src/streamlink/plugins/euronews.py b/src/streamlink/plugins/euronews.py
--- a/src/streamlink/plugins/euronews.py
+++ b/src/streamlink/plugins/euronews.py
@@ -3,10 +3,11 @@
 from streamlink.plugin import Plugin
 from streamlink.plugin.api import validate
 from streamlink.stream import HLSStream, HTTPStream
+from streamlink.utils.url import update_scheme
 
 
 class Euronews(Plugin):
-    _url_re = re.compile(r"http(?:s)?://(\w+)\.?euronews.com/(live|.*)")
+    _url_re = re.compile(r'(?P<scheme>https?)://(?P<subdomain>\w+)\.?euronews.com/(?P<path>live|.*)')
     _re_vod = re.compile(r'<meta\s+property="og:video"\s+content="(http.*?)"\s*/>')
     _live_api_url = "http://{0}.euronews.com/api/watchlive.json"
     _live_schema = validate.Schema({
@@ -32,28 +33,29 @@ def _get_vod_stream(self):
         if len(video_urls):
             return dict(vod=HTTPStream(self.session, video_urls[0]))
 
-    def _get_live_streams(self, subdomain):
+    def _get_live_streams(self, match):
         """
         Get the live stream in a particular language
-        :param subdomain:
+        :param match:
         :return:
         """
-        res = self.session.http.get(self._live_api_url.format(subdomain))
-        live_res = self.session.http.json(res, schema=self._live_schema)
-        api_res = self.session.http.get(live_res[u"url"])
-        stream_data = self.session.http.json(api_res, schema=self._stream_api_schema)
-        return HLSStream.parse_variant_playlist(self.session, stream_data[u'primary'])
+        live_url = self._live_api_url.format(match.get("subdomain"))
+        live_res = self.session.http.json(self.session.http.get(live_url), schema=self._live_schema)
+
+        api_url = update_scheme("{0}:///".format(match.get("scheme")), live_res["url"])
+        api_res = self.session.http.json(self.session.http.get(api_url), schema=self._stream_api_schema)
+
+        return HLSStream.parse_variant_playlist(self.session, api_res["primary"])
 
     def _get_streams(self):
         """
         Find the streams for euronews
         :return:
         """
-        match = self._url_re.match(self.url)
-        subdomain, path = match.groups()
+        match = self._url_re.match(self.url).groupdict()
 
-        if path == "live":
-            return self._get_live_streams(subdomain)
+        if match.get("path") == "live":
+            return self._get_live_streams(match)
         else:
             return self._get_vod_stream()
 


Test patch: