Repository: streamlink/streamlink

Issue:
plugins.euronews:  the stream replaced with youtube
<!--
Thanks for reporting a plugin issue!
USE THE TEMPLATE. Otherwise your plugin issue may be rejected.

First, see the contribution guidelines:
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink

Plugin issues describe broken functionality within a plugin's code base, eg. the streaming site has made breaking changes, streams don't get resolved correctly, or authentication has stopped working, etc.

Also check the list of open and closed plugin issues:
https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22

Please see the text preview to avoid unnecessary formatting errors.
-->


## Plugin Issue

<!-- Replace the space character between the square brackets with an x in order to check the boxes -->
- [x] This is a plugin issue and I have read the contribution guidelines.
- [x] I am using the latest development version from the master branch.


### Description

<!-- Explain the plugin issue as thoroughly as you can. -->

The plugin doesn't work now as the stream on https://www.euronews.com/live is replaced with youtube embedded https://youtu.be/sPgqEHsONK8 . I don't know is it a permanent or a temporary decision. There are cases of moving back. So I don't think the plugin should be removed but rather suspended in some way or temporarily disabled. 
### 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. -->
```
streamlink euronews.com/live
```
### Log output

<!--
DEBUG LOG OUTPUT IS REQUIRED for a plugin issue!
INCLUDE THE ENTIRE COMMAND LINE and make sure to **remove usernames and passwords**

Use the `--loglevel debug` parameter and avoid using parameters which suppress log output.
Debug log includes important details about your platform. Don't remove it.
https://streamlink.github.io/latest/cli.html#cmdoption-loglevel

You can copy the output to https://gist.github.com/ or paste it below.

Don't post screenshots of the log output and instead copy the text from your terminal application.
-->

```
[cli][info] Found matching plugin euronews for URL euronews.com/live
error: Unable to validate JSON: Unable to validate key 'url': Type of None should be 'str' but is 'NoneType'
```


### Additional comments, etc.

You can watch this TV channel on youtube or with streamlink:
```
streamlink youtube.com/EuronewsUSA/live
```
It exists for a long time and the only regret is that resolution reduced from 1080p to 720p.



Discussion:
Only the live stream has moved to YT, VODs are still hosted on their site, which means the plugin can't be removed.

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
@@ -1,61 +1,52 @@
 import re
+from urllib.parse import urlparse
 
 from streamlink.plugin import Plugin
 from streamlink.plugin.api import validate
-from streamlink.stream import HLSStream, HTTPStream
-from streamlink.utils.url import update_scheme
+from streamlink.plugin.api.utils import itertags
+from streamlink.stream import HTTPStream
 
 
 class Euronews(Plugin):
-    _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({
-        "url": validate.url()
-    })
-    _stream_api_schema = validate.Schema({
-        "status": "ok",
-        "primary": validate.url(),
-        validate.optional("backup"): validate.url()
-    })
+    _url_re = re.compile(r'https?://(?:\w+\.)*euronews\.com/')
 
     @classmethod
     def can_handle_url(cls, url):
         return cls._url_re.match(url)
 
     def _get_vod_stream(self):
-        """
-        Find the VOD video url
-        :return: video url
-        """
-        res = self.session.http.get(self.url)
-        video_urls = self._re_vod.findall(res.text)
-        if len(video_urls):
-            return dict(vod=HTTPStream(self.session, video_urls[0]))
-
-    def _get_live_streams(self, match):
-        """
-        Get the live stream in a particular language
-        :param match:
-        :return:
-        """
-        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 find_video_url(content):
+            for elem in itertags(content, "meta"):
+                if elem.attributes.get("property") == "og:video":
+                    return elem.attributes.get("content")
+
+        video_url = self.session.http.get(self.url, schema=validate.Schema(
+            validate.transform(find_video_url),
+            validate.any(None, validate.url())
+        ))
+
+        if video_url is not None:
+            return dict(vod=HTTPStream(self.session, video_url))
+
+    def _get_live_streams(self):
+        def find_video_id(content):
+            for elem in itertags(content, "div"):
+                if elem.attributes.get("id") == "pfpPlayer" and elem.attributes.get("data-google-src") is not None:
+                    return elem.attributes.get("data-video-id")
+
+        video_id = self.session.http.get(self.url, schema=validate.Schema(
+            validate.transform(find_video_id),
+            validate.any(None, str)
+        ))
+
+        if video_id is not None:
+            return self.session.streams(f"https://www.youtube.com/watch?v={video_id}")
 
     def _get_streams(self):
-        """
-        Find the streams for euronews
-        :return:
-        """
-        match = self._url_re.match(self.url).groupdict()
-
-        if match.get("path") == "live":
-            return self._get_live_streams(match)
+        parsed = urlparse(self.url)
+
+        if parsed.path == "/live":
+            return self._get_live_streams()
         else:
             return self._get_vod_stream()
 


Test patch: