-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathgulli.py
More file actions
50 lines (39 loc) · 1.32 KB
/
Copy pathgulli.py
File metadata and controls
50 lines (39 loc) · 1.32 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
$description French live TV channel and video on-demand service owned by Gulli.
$url replay.gulli.fr
$type live, vod
$region France
"""
import re
from streamlink.logger import getLogger
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = getLogger(__name__)
@pluginmatcher(
name="live",
pattern=re.compile(r"https?://replay\.gulli\.fr/Direct"),
)
@pluginmatcher(
name="vod",
pattern=re.compile(r"https?://replay\.gulli\.fr/.+-(?P<video_id>(?i:vod)\d+)$"),
)
class Gulli(Plugin):
LIVE_PLAYER_URL = "https://replay.gulli.fr/jwplayer/embedstreamtv"
VOD_PLAYER_URL = "https://replay.gulli.fr/jwplayer/embed/{0}"
def _get_streams(self):
if self.matches["live"]:
player_url = self.LIVE_PLAYER_URL
else:
player_url = self.VOD_PLAYER_URL.format(self.match["video_id"])
video_url = self.session.http.get(
player_url,
schema=validate.Schema(
validate.parse_html(),
validate.xml_xpath_string(".//video-js[1]/source[@src][@type='application/x-mpegURL'][1]/@src"),
),
)
if not video_url:
return
return HLSStream.parse_variant_playlist(self.session, video_url)
__plugin__ = Gulli