spiff Wrote:Hmm install rbk using the addon installer. and done you have the source.
Did that got the code and it seems i am doing everything as per rbk.no. This is frustrating I want to give it one last shot before i give up. The code I am using below its able to scrape the site and return the url list only when i click it to play i am getting script error. i am using the same script provided in the vionage tutorial with changes required for this site.. see script...
My issue i think is in the VIDEOLINKS(url,name) section. Can anyone have a quick look please.....
Code:
import urllib,urllib2,re,xbmcplugin,xbmcgui
#TV DASH - by You 2008.
def CATEGORIES():
addDir("Vijay TV Shows","http://www.rajtamil.com/search/label/Vijay%20TV%20shows?max-results=25",1,"http://reggiebibbs.files.wordpress.com/2007/12/the-movies360-crop.jpg")
addDir( 'SUN TV Shows','http://www.rajtamil.com/search/label/Sun%20TV%20Shows?max-results=25',2,'http://www.homefrontcalgary.com/assets/images/news_images/tv(2).jpg')
def INDEX(url):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('<a href=''(.+?)'' title=''(.+?)''>(.+?)</a>').findall(link)
for url,name,thumbnail in match:
addDir(name,url,4,thumbnail)
def INDEX2(url):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('<a title="Watch (.+?) Online" href="(.+?)"><img src="(.+?)"').findall(link)
for name,url,thumb in match:
addDir(name,'http://www.tvdash.com/'+url,3,thumb)
def EPISODES(url):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('<a title="Watch (.+?) Online" href="(.+?)"><img src="(.+?)"').findall(link)
for name,url,thumb in match:
if not thumb.find('http://')>0:
thumb='http://www.tvdash.com/'+thumb
addDir(name,'http://www.tvdash.com/'+url,4,thumb)
def VIDEOLINKS(url,name):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('<embed src="http://www.youtube.com/.+?/(.+?)?version=.+?" type=".+?"').findall(link)
url = 'plugin://plugin.video.youtube/?action=play_video&videoid='+ + match[0].replace('?','')
addLink(name,url,'')
def get_params():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'):
params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
param={}
for i in range(len(pairsofparams)):
splitparams={}
splitparams=pairsofparams[i].split('=')
if (len(splitparams))==2:
param[splitparams[0]]=splitparams[1]
return param
def addLink(name,url,iconimage):
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
liz.setProperty("IsPlayable","true")
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz,isFolder=False)
return ok
def addDir(name,url,mode,iconimage):
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok
params=get_params()
url=None
name=None
mode=None
try:
url=urllib.unquote_plus(params["url"])
except:
pass
try:
name=urllib.unquote_plus(params["name"])
except:
pass
try:
mode=int(params["mode"])
except:
pass
print "Mode: "+str(mode)
print "URL: "+str(url)
print "Name: "+str(name)
if mode==None or url==None or len(url)<1:
print ""
CATEGORIES()
elif mode==1:
print ""+url
INDEX(url)
elif mode==2:
print ""+url
INDEX2(url)
elif mode==3:
print ""+url
EPISODES(url)
elif mode==4:
print ""+url
VIDEOLINKS(url,name)
xbmcplugin.endOfDirectory(int(sys.argv[1]))