I'm Making an Add-On for LEGAL TV CATCHUP. READ MORE. I NEED HELP.
#1
So I'm making an addon for catchup on the following sites.

flowerstv.in
mazhavilmanorama.com/videos/playlists/thateem-mutteem.html, as well as the other shows.

The problems I'm facing.

The first site, I'm able to scrape the site for videos e.t.c
I'm just having a problem for when the url is scraped, on how to play it. i tried using urlresolver, but I can't get it to work.
I'll paste the cod below.

For the second site, I'm able to scrape the site for all the info I need, except the link to play. This is because they use brightcove to play videos. If anyone knows how to decode the link please reply.

MY CODE FOR THE FIRST SiTE. I've tried using urlresolver, but i can't get it to resolve the url. 


import xbmcaddon,os,requests,xbmc,xbmcgui,urllib,urllib2,re,xbmcplugin




from resources.lib.modules.channels import *

def CATEGORIES():
   r = requests.get('http://www.flowerstv.in/category/uppum-mulakum/')
   match = re.compile('data-original="(.+?)" alt="(.+?)" />.+?effect"><a href="(.+?)"',re.DOTALL).findall(r.content)
   for image,name,url in match:
     addDir3(name.replace('–','-'),'',3,image,'','')

def UPPU(url,name):
   r = requests.get('url')
   match = re.compile('Url" src="(.+?)".+?alt="(.+?)".+?<p><iframe src="(.+?)"',re.DOTALL).findall(r.content)
   for image,name,url in match:
     addDir3(name,'',3,image,'','')


#So here, the addon can scrape almost everything.
#The '' in addDir 3 is the url.

#How can I play that 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       
#################################################################################################################

#                               NEED BELOW CHANGED

  
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
     
def addDir2(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=False)
        return ok
###############################################################################################################        

def addDir3(name,url,mode,iconimage,fanart,description):
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&fanart="+urllib.quote_plus(fanart)+"&description="+urllib.quote_plus(description)
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name, "Plot": description } )
        liz.setProperty( "Fanart_Image", fanart )
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
        return ok


def setView(content, viewType):
    # set content type so library shows more views and info
    if content:
        xbmcplugin.setContent(int(sys.argv[1]), content)
    if ADDON.getSetting('auto-view')=='true':
        xbmc.executebuiltin("Container.SetViewMode(%s)" % viewType )
 


              
params=get_params()
url=None
name=None
mode=None
iconimage=None
fanart=None
description=None


try:
        url=urllib.unquote_plus(params["url"])
except:
        pass
try:
        name=urllib.unquote_plus(params["name"])
except:
        pass
try:
        iconimage=urllib.unquote_plus(params["iconimage"])
except:
        pass
try:        
        mode=int(params["mode"])
except:
        pass
try:        
        fanart=urllib.unquote_plus(params["fanart"])
except:
        pass
try:        
        description=urllib.unquote_plus(params["description"])
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:
        OPEN_URL(url)
elif mode==3:
        UPPU(url,name)


xbmcplugin.endOfDirectory(int(sys.argv[1]))
Reply
#2
I FORGOT TO MENTION THIS.

THE FIRST SITE IS SCRApING YOUTUBE LINKS, YOUTUBE EMBEDDEd LINKS.

THE SECOND SITE IS TRYINE TO SCRAPE THIS FOR A LINK
https://players.brightcove.net/557432116...true&muted

THANKS.
Reply
#3
Please use a pastebin site or something similar for code. Just dropping it unformatted here both bloats our database unnecessarily and makes it very difficult to read/analyse.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#4
Okay.
Reply
#5
Here is the pastebin link.
https://pastebin.com/B5ijfz7T
Reply
#6
The proper way is to use xbmcplugin.SetResolvedUrl(). I have never gotten it to work, as I specifically need custom scrobbling and watched state support, but it may work for you to let kodi handle that. Another thing you should do is look at the code for the YouTube plugin, as it does basically exactly what you want. If you can't read that code, then you definitely can't write it (well), so take that advice with it. Working with Kodi's addon system takes a few years to get properly experienced with, so good luck.
Developer for Shoko and Nakamori. Long time user of Kodi, before it was even called Kodi. My XBOX died long ago, but Windows is still just as broken and necessary. I obviously watch anime, given my first comment. Video games, manga, music, you name it.
Reply

Logout Mark Read Team Forum Stats Members Help
I'm Making an Add-On for LEGAL TV CATCHUP. READ MORE. I NEED HELP.0