Repository: streamlink/streamlink

Issue:
plugins.rtvs: No playable streams found on
### Checklist

- [X] This is a plugin issue and not a different kind of issue
- [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)
- [X] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)
- [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)

### Streamlink version

Latest build from the master branch

### Description

rtvs plugin - stream not work

### Debug log

```text
PS C:\Users\My> streamlink https://www.rtvs.sk/televizia/live-24 --loglevel debug
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.11.2
[cli][debug] Streamlink: 5.3.1
[cli][debug] Dependencies:
[cli][debug]  certifi: 2022.12.7
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.2
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.17
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.2
[cli][debug]  urllib3: 1.26.14
[cli][debug]  websocket-client: 1.5.1
[cli][debug] Arguments:
[cli][debug]  url=https://www.rtvs.sk/televizia/live-24
[cli][debug]  --loglevel=debug
[cli][debug]  --ffmpeg-ffmpeg=C:\Program Files\Streamlink\ffmpeg\ffmpeg.exe
[cli][info] Found matching plugin rtvs for URL https://www.rtvs.sk/televizia/live-24
error: No playable streams found on this URL: https://www.rtvs.sk/televizia/live-24
```



Discussion:

Resolving patch:
diff --git a/src/streamlink/plugins/rtvs.py b/src/streamlink/plugins/rtvs.py
--- a/src/streamlink/plugins/rtvs.py
+++ b/src/streamlink/plugins/rtvs.py
@@ -6,47 +6,52 @@
 """
 
 import re
+from urllib.parse import urlparse
 
 from streamlink.plugin import Plugin, pluginmatcher
 from streamlink.plugin.api import validate
 from streamlink.stream.hls import HLSStream
-from streamlink.utils.parse import parse_json
 
 
 @pluginmatcher(re.compile(
-    r"https?://www\.rtvs\.sk/televizia/live-[\w-]+",
+    r"https?://www\.rtvs\.sk/televizia/(?:live-|sport)",
 ))
 class Rtvs(Plugin):
-    _re_channel_id = re.compile(r"'stream':\s*'live-(\d+)'")
-
     def _get_streams(self):
-        res = self.session.http.get(self.url)
-        m = self._re_channel_id.search(res.text)
-        if not m:
+        channel = self.session.http.get(self.url, schema=validate.Schema(
+            validate.parse_html(),
+            validate.xml_xpath_string(".//iframe[@id='player_live']//@src"),
+            validate.url(path=validate.startswith("/embed/live/")),
+            validate.transform(lambda embed: urlparse(embed).path[len("/embed/live/"):]),
+        ))
+        if not channel:
             return
 
-        res = self.session.http.get(
+        videos = self.session.http.get(
             "https://www.rtvs.sk/json/live5f.json",
             params={
-                "c": m.group(1),
+                "c": channel,
                 "b": "mozilla",
                 "p": "win",
                 "f": "0",
                 "d": "1",
             },
+            schema=validate.Schema(
+                validate.parse_json(),
+                {
+                    "clip": {
+                        "sources": [{
+                            "src": validate.url(),
+                            "type": str,
+                        }],
+                    },
+                },
+                validate.get(("clip", "sources")),
+                validate.filter(lambda n: n["type"] == "application/x-mpegurl"),
+            ),
         )
-        videos = parse_json(res.text, schema=validate.Schema({
-            "clip": {
-                "sources": [{
-                    "src": validate.url(),
-                    "type": str,
-                }],
-            }},
-            validate.get(("clip", "sources")),
-            validate.filter(lambda n: n["type"] == "application/x-mpegurl"),
-        ))
         for video in videos:
-            yield from HLSStream.parse_variant_playlist(self.session, video["src"]).items()
+            return HLSStream.parse_variant_playlist(self.session, video["src"])
 
 
 __plugin__ = Rtvs


Test patch:
diff --git a/tests/plugins/test_rtvs.py b/tests/plugins/test_rtvs.py
--- a/tests/plugins/test_rtvs.py
+++ b/tests/plugins/test_rtvs.py
@@ -6,13 +6,17 @@ class TestPluginCanHandleUrlRtvs(PluginCanHandleUrl):
     __plugin__ = Rtvs
 
     should_match = [
-        "http://www.rtvs.sk/televizia/live-1",
-        "http://www.rtvs.sk/televizia/live-2",
-        "http://www.rtvs.sk/televizia/live-o",
+        "https://www.rtvs.sk/televizia/live-1",
+        "https://www.rtvs.sk/televizia/live-2",
         "https://www.rtvs.sk/televizia/live-3",
+        "https://www.rtvs.sk/televizia/live-o",
         "https://www.rtvs.sk/televizia/live-rtvs",
+        "https://www.rtvs.sk/televizia/live-nr-sr",
+        "https://www.rtvs.sk/televizia/sport",
     ]
 
     should_not_match = [
         "http://www.rtvs.sk/",
+        "http://www.rtvs.sk/televizia/archiv",
+        "http://www.rtvs.sk/televizia/program",
     ]