Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/default.py 2012-02-16 10:13:54.000000000 +0100
- +++ b/default.py 2012-03-30 20:08:40.000000000 +0200
- @@ -2,12 +2,14 @@
- import xbmcgui
- import sys
- import urllib, urllib2
- +import time
- import re
- from htmlentitydefs import name2codepoint as n2cp
- thisPlugin = int(sys.argv[1])
- urlHost = "http://rtl2now.rtl2.de"
- +ajaxUrl = "/xajaxuri.php"
- # -----regexContent-------
- # [0] is url (/foo.php)
- # [1] is name (foo is bar)
- @@ -21,9 +23,12 @@
- # the free-content will be filtered in code (paytype)
- regexContent = '<div class="seriennavi_free" style=""><a href="(.*?)".*?>FREE.*?</div>.*?<div style="" class="seriennavi_link">.*?">(.*?)</a>.*?</div>'
- -regexSeries = '<div class="line (even|odd)"><div onclick="link\(\'(.*?)\'\); return false;".*?<a href=".*?" title=".*?">(.*?)</a>.*?class="time">(.*?)</div>.*?class="minibutton">(.*?)</a></div></div>'
- +regexSeries = '<div class="line (even|odd)"><div onclick="link\(\'(.*?)\'\); return false;".*?<a href=".*?" title=".*?">(.*?)</a>.*?class="time">(.*?</div>.*?)</div>.*?class="minibutton">(.*?)</a></div></div>'
- regexVideoData = "data:'(.*?)'"
- regexXML = '<filename><!\[CDATA\[(.*?)\]\]></filename>'
- +regexTextOnly = '<\s*\/?\s*\s*.*?>'
- +regexTabVars = '<select\s*?onchange.*?xajax_show_top_and_movies.*?\'(.*?)\'.*?\'(.*?)\'.*?\'(.*?)\'.*?\'(.*?)\'.*?\'(.*?)\'.*?>(.*?)</select>'
- +regexTabEntry = '<option.*?value=\'(\d)\'.*?>'
- # ------------------------
- def showContent():
- @@ -41,18 +46,30 @@
- global thisPlugin
- content = getUrl(urlS)
- +
- + vars = re.compile(regexTabVars,re.DOTALL).search(content)
- +
- + if vars:
- + tabVars = "&xajaxargs[]="+vars.group(1)+"&xajaxargs[]="+vars.group(2)+"&xajaxargs[]="+vars.group(3)+"&xajaxargs[]="+vars.group(4)+"&xajaxargs[]="+vars.group(5)+"&xajax=show_top_and_movies&xajaxr="+str(time.time()).replace('.','')
- + tabentries = re.compile(regexTabEntry,re.DOTALL).findall(vars.group(6))
- + content = ""
- +
- + for te in tabentries:
- + ajcon = postUrl(urlHost+ajaxUrl,"xajaxargs[]="+te+tabVars);
- + content += ajcon;
- +
- match = re.compile(regexSeries,re.DOTALL).findall(content)
- print match
- for m in match:
- print m
- if "kostenlos" in m[4]:
- ##xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=m[3]+" "+decode_htmlentities(m[2]), isFolder=False)
- - addDirectoryItem(decode_htmlentities(m[2])+" - "+m[3], {"urlV": m[1]})
- + addDirectoryItem(decode_htmlentities(m[2])+" - "+remHTML(m[3]), {"urlV": m[1], "vidN": m[2]})
- ##print m[2]
- print "--- showSeries ok"
- xbmcplugin.endOfDirectory(thisPlugin)
- -def showVideo(urlV):
- +def showVideo(urlV, vidN):
- print "--- showVideo"
- global thisPlugin
- print "--- "+urlV
- @@ -81,7 +98,7 @@
- swfUrl = "http://rtl2now.rtl2.de/includes/vodplayer.swf"
- pageUrl = "http://rtl2now.rtl2.de/p"
- - item = xbmcgui.ListItem("SuperRTL")
- + item = xbmcgui.ListItem(vidN)
- fullData=videoUrl+' swfVfy=1 playpath='+playpath+' app=rtl2now/_definst_ pageUrl='+pageUrl+'/ tcUrl='+videoUrl+' swfUrl='+swfUrl
- print fullData
- @@ -90,6 +107,17 @@
- # ------ helper ------
- +def remHTML(text):
- + result = re.compile(regexTextOnly,re.DOTALL).sub('',text)
- + return result
- +
- +def postUrl(url, values):
- + req = urllib2.Request(url)
- + response = urllib2.urlopen(req, values)
- + link=response.read()
- + response.close()
- + return link
- +
- def getUrl(url):
- req = urllib2.Request(url)
- response = urllib2.urlopen(req)
- @@ -138,6 +166,7 @@
- params = parameters_string_to_dict(sys.argv[2])
- urlSeries = str(params.get("urlS", ""))
- urlVideo = str(params.get("urlV", ""))
- +vidName = str(params.get("vidN", ""))
- if not sys.argv[2]:
- # new start
- @@ -150,6 +179,6 @@
- if urlVideo:
- newUrl = urlHost + decode_htmlentities(urllib.unquote(urlVideo))
- print newUrl
- - ok = showVideo(newUrl)
- + ok = showVideo(newUrl, decode_htmlentities(urllib.unquote_plus(vidName)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement