summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenen92 <92enen@gmail.com>2018-01-08 15:09:53 +0000
committerMartijn Kaijser <martijn@xbmc.org>2018-01-08 18:16:05 +0100
commit1867a2109782d9b305840fedd1d230794ed5334b (patch)
tree60623e1208cc6e0659e9e8dd02573b4f4e58dd33
parentdd412ea77868248458fe91923d975b31a7cdee87 (diff)
[plugin.video.rtpplay] 3.0.4
-rw-r--r--plugin.video.rtpplay/addon.xml2
-rw-r--r--plugin.video.rtpplay/resources/lib/plugin.py68
2 files changed, 40 insertions, 30 deletions
diff --git a/plugin.video.rtpplay/addon.xml b/plugin.video.rtpplay/addon.xml
index 87f5065..7a27fa3 100644
--- a/plugin.video.rtpplay/addon.xml
+++ b/plugin.video.rtpplay/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.rtpplay" name="RTP Play" version="3.0.3" provider-name="enen92">
+<addon id="plugin.video.rtpplay" name="RTP Play" version="3.0.4" provider-name="enen92">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.routing" version="0.2.0"/>
diff --git a/plugin.video.rtpplay/resources/lib/plugin.py b/plugin.video.rtpplay/resources/lib/plugin.py
index 3ea0046..12da39f 100644
--- a/plugin.video.rtpplay/resources/lib/plugin.py
+++ b/plugin.video.rtpplay/resources/lib/plugin.py
@@ -36,7 +36,7 @@ def index():
kodiutils.ok(kodiutils.get_string(32000),kodiutils.get_string(32001))
exit(0)
- match=re.compile('<a title=".+?direto (.+?)" href="(.+?)".+?img.+?src="(.+?)" class="img-responsive">.+?<span class="small"><b>(.+?)</b>').findall(req)
+ match=re.compile('<a\s*title=".+?direto\s*(.+?)"\s*href="(.+?)".+?img.+?src="(.+?)"\s*class="img-responsive">.+?<span class="small"><b>(.+?)</b>').findall(req)
if match:
for channel,rel_url, img, prog in match:
liz = ListItem("[B][COLOR blue]{}[/B][/COLOR] ({})".format(kodiutils.smart_str(channel), kodiutils.smart_str(prog)))
@@ -66,35 +66,45 @@ def play():
is_pseudo_aes = bool(re.findall("var aes = true", req))
- player = re.findall("liveMetadata.+?'(\d+)'\)", req)
- player = player[0].strip() if player else ''
-
- streams = re.compile('{} =.+?RTPPlayer.+?file\:.+?"(.+?)"'.format(player),re.DOTALL).findall(req)
-
- if streams:
- final_stream_url = None
- for stream in streams:
- if ".m3u8" in stream.split('/')[-1]:
- final_stream_url = stream
- break
-
- if is_pseudo_aes:
- try:
- req = __session__.post("http://www.rtp.pt/services/playRequest.php", headers={"RTPPlayUrl": final_stream_url})
- final_stream_url = req.headers["RTPPlayWW"]
- except:
- kodiutils.ok(kodiutils.get_string(32000),kodiutils.get_string(32002))
- exit(0)
-
- if final_stream_url:
- liz = ListItem("[B][COLOR blue]{}[/B][/COLOR] ({})".format(kodiutils.smart_str(channel), kodiutils.smart_str(prog)))
- liz.setArt({"thumb": icon, "icon": icon})
- liz.setProperty('IsPlayable', 'true')
- liz.setPath("{}|User-Agent=Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36&Referer=http://www.rtp.pt/play/".format(final_stream_url))
- setResolvedUrl(plugin.handle, True, liz)
+ js = re.compile("<script(.*?)\<\/script",re.DOTALL).findall(req)
+ ic = '\n'.join(js)
+ ic = re.sub('<--(.*?)-->', '', ic, flags=re.DOTALL)
+ ic = re.sub('(?m)^\//.*\n?', '', ic)
+
+ player_index = re.findall("(.+?)\.newPlayer\(\)", ic)
+
+ if player_index:
+
+ streams = re.compile('{}\s*=.+?RTPPlayer.+?file\:.+?"(.+?)"'.format(player_index[0].strip()),re.DOTALL).findall(req)
+
+ if streams:
+ final_stream_url = None
+ for stream in streams:
+ if ".m3u8" in stream.split('/')[-1]:
+ final_stream_url = stream
+ break
+
+ if is_pseudo_aes:
+ try:
+ req = __session__.post("http://www.rtp.pt/services/playRequest.php", headers={"RTPPlayUrl": final_stream_url})
+ final_stream_url = req.headers["RTPPlayWW"]
+ except:
+ raise_notification()
+
+ if final_stream_url:
+ liz = ListItem("[B][COLOR blue]{}[/B][/COLOR] ({})".format(kodiutils.smart_str(channel), kodiutils.smart_str(prog)))
+ liz.setArt({"thumb": icon, "icon": icon})
+ liz.setProperty('IsPlayable', 'true')
+ liz.setPath("{}|User-Agent=Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36&Referer=http://www.rtp.pt/play/".format(final_stream_url))
+ setResolvedUrl(plugin.handle, True, liz)
+ else:
+ raise_notification()
else:
- kodiutils.ok(kodiutils.get_string(32000),kodiutils.get_string(32002))
- exit(0)
+ raise_notification()
+
+def raise_notification():
+ kodiutils.ok(kodiutils.get_string(32000),kodiutils.get_string(32002))
+ exit(0)
def run():
plugin.run()