-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathrtpa.py
More file actions
33 lines (27 loc) · 990 Bytes
/
Copy pathrtpa.py
File metadata and controls
33 lines (27 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
$description Live TV channels and video on-demand service from RTPA, a Spanish public broadcaster.
$url rtpa.es
$type live, vod
$metadata title
"""
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
@pluginmatcher(re.compile(r"https?://(?:www\.)?rtpa\.es"))
class RTPA(Plugin):
def _get_streams(self):
hls_url, self.title = self.session.http.get(
self.url,
schema=validate.Schema(
validate.parse_html(),
validate.union((
validate.xml_xpath_string(".//video/source[@src][@type='application/x-mpegURL'][1]/@src"),
validate.xml_xpath_string(".//head/title[1]/text()"),
)),
),
)
if not hls_url:
return
return HLSStream.parse_variant_playlist(self.session, hls_url, headers={"Referer": self.url})
__plugin__ = RTPA