Esempio n. 1
0
    def __init__( self ):
            pid = common.args.pid
            #url containing video link
            url = "http://release.theplatform.com/content.select?format=SMIL&Tracking=true&balance=true&MBR=true&pid=" + pid
            if (common.settings['proxy'] == 'true'):
                link=common.getHTML(url,True)
            else:
                link=common.getHTML(url)
            print link
            if "rtmp://" in link:
                    stripurls = re.compile('<video src="rtmp://(.+?)" system-bitrate="(.+?)" width="(.+?)" height="(.+?)" profile="(.+?)"').findall(link)
                    #hpixels = 0
                    hbitrate = -1
                    sbitrate = int(common.settings['quality'])
                    for stripurl, bitrate, w, h, profile in stripurls:    
                        #pixels = int(w) * int(h)
                        #if pixels > hpixels:
                        #    hpixels = pixels
                        bitrate = int(bitrate)
                        if bitrate > hbitrate and bitrate < sbitrate:
                            hbitrate = bitrate
                            cleanurl = stripurl.replace('&amp;','&').replace('&lt;','<').replace('&gt;','>').split('<break>')
                            finalurl = "rtmp://" + cleanurl[0]
                            if ".mp4" in cleanurl[1]:
                                    playpath = 'mp4:' + cleanurl[1]
                            else:
                                    playpath = cleanurl[1].replace('.flv','')

            swfUrl = "http://www.cbs.com/thunder/player/1_0/chromeless/1_5_1/CAN.swf"
            finalurl += ' playpath='+playpath + " swfurl=" + swfUrl + " swfvfy=true"
            item = xbmcgui.ListItem(path=finalurl)
            xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Esempio n. 2
0
    def addEpisodeList(self):

        print " \n\n adding episodes \n\n"

        content = common.getHTML(common.args.url)

        # get the RSS feed URL and slurp it
        rssURL = re.compile('var _rssURL = "(.+?)";').findall(
            content)[0].replace('%26', '&')
        content = common.getHTML(rssURL)

        # title, watchURL, plot, thumbnail
        episodeInfo = re.compile(
            '<item>.+?<title>.+?CDATA\[(.+?)\].+?<link>(.+?id=\d+).+?</link>.+?<description>.+?CDATA\[(.+?)\].+?thumbnail.+?url="(.+?)"',
            re.DOTALL).findall(content, re.DOTALL)

        # add episodes
        for title, watchURL, plot, thumbnail in episodeInfo:
            # see if we want plots
            plot = (
                '',
                common.cleanNames(plot))[common.settings['get_episode_plot']]
            common.addDirectory(common.cleanNames(title), watchURL,
                                'TV_play_usa', thumbnail, thumbnail,
                                common.args.fanart, plot, 'genre')
Esempio n. 3
0
    def __init__(self):
        pid = common.args.pid
        #url containing video link
        url = "http://release.theplatform.com/content.select?format=SMIL&Tracking=true&balance=true&MBR=true&pid=" + pid
        if (common.settings['proxy'] == 'true'):
            link = common.getHTML(url, True)
        else:
            link = common.getHTML(url)
        print link
        if "rtmp://" in link:
            stripurls = re.compile(
                '<video src="rtmp://(.+?)" system-bitrate="(.+?)" width="(.+?)" height="(.+?)" profile="(.+?)"'
            ).findall(link)
            #hpixels = 0
            hbitrate = -1
            sbitrate = int(common.settings['quality'])
            for stripurl, bitrate, w, h, profile in stripurls:
                #pixels = int(w) * int(h)
                #if pixels > hpixels:
                #    hpixels = pixels
                bitrate = int(bitrate)
                if bitrate > hbitrate and bitrate < sbitrate:
                    hbitrate = bitrate
                    cleanurl = stripurl.replace('&amp;', '&').replace(
                        '&lt;', '<').replace('&gt;', '>').split('<break>')
                    finalurl = "rtmp://" + cleanurl[0]
                    if ".mp4" in cleanurl[1]:
                        playpath = 'mp4:' + cleanurl[1]
                    else:
                        playpath = cleanurl[1].replace('.flv', '')

        swfUrl = "http://www.cbs.com/thunder/player/1_0/chromeless/1_5_1/CAN.swf"
        finalurl += ' playpath=' + playpath + " swfurl=" + swfUrl + " swfvfy=true"
        item = xbmcgui.ListItem(path=finalurl)
        xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Esempio n. 4
0
    def addShowsList( self ):
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_GENRE)

        html=common.getHTML(common.args.url)
        tree=MinimalSoup(html)
        shows=tree.findAll('a', attrs={"class":"show-thumb info_hover"})
        del html
        del tree
        # with clips
        for show in shows:
            name  = show.contents[0].replace('&quot;','"').replace('&amp;','&')
            url   = show['href']
            tmp   = show['href'].split('/')[3]
            art   = "http://assets.hulu.com/shows/key_art_"+tmp.replace('-','_')+".jpg"
            #thumb = "http://assets.hulu.com/shows/show_thumbnail_"+tmp.replace('-','_')+".jpg"
            #icon  = "http://assets.hulu.com/shows/show_thumbnail_"+tmp.replace('-','_')+".jpg"
            #Use higher res fanart (key_art) instead of lower res thumbs & icons
            thumb = art
            icon = art
            if common.settings['get_show_plot'] == True:
                json = common.getHTML("http://www.hulu.com/shows/info/"+tmp)
                try:
                    #this needs better regex, or maybe some sort of json parser
                    p = re.compile('description: "(.+?)"[,}]')
                    match = p.findall(json)
                    plot = match[0].replace('\\','')
                except:
                    plot=xbmc.getLocalizedString(30090)
                try:
                    p = re.compile('channel: "(.+?)"[,}]')
                    match = p.findall(json)
                    genre = match[0]
                except:
                    genre=xbmc.getLocalizedString(30090)
                #hopefully deleting this will help with xbox memory problems
                del json
            else:
                plot=genre=xbmc.getLocalizedString(30090)
            try:
                if show.parent['class'] != "full-episode-icon":
                    name += ' '+xbmc.getLocalizedString(30091)
                    genre += ' '+xbmc.getLocalizedString(30091)
                elif common.args.url != common.BASE_TV_URL:
                    common.addDirectory(name, url, "TV_Seasons", art, icon, art, plot, genre)
            except:
                name += ' '+xbmc.getLocalizedString(30091)
                genre += ' '+xbmc.getLocalizedString(30091)
                if common.settings['only_full_episodes'] == False:
                    common.addDirectory(name, url, "TV_Seasons", art, icon, art, plot, genre)
        
        #if we're doing both clips & full episodes, we need to run through the function again.
        if common.args.url == common.BASE_TV_URL :
            common.args.url = common.BASE_FULLTV_URL
            self.addShowsList()
        
        xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))
Esempio n. 5
0
    def addEpisodeList( self ):

        print " \n\n adding episodes \n\n"

        content=common.getHTML(common.args.url)

        # get list of pages of additional episodes, if we have any
        try:
            pagesSegment=re.search('div class="nbcu_pager".+?class="nbcu_pager_last">', content, re.DOTALL).group(0)
            pages=common.unique(re.compile('<a href="(.+?)"').findall(pagesSegment))
            print pages
        except:
            pages=None

        # get episode list per page
        episodeListSegment=re.search('<div class="scet-gallery-content">.+?</div><!-- item list -->', content, re.DOTALL).group(0)

        # title, thumbnail, watchURL, episode, plot
        episodeInfo=re.compile('<li class="list_full_detail_horiz" >.+?href="(.+?)".+?title="(.+?)"><img src="(.+?)".+?<strong>.+?Ep\. (\d+):.+?</div>.+?</li>', re.DOTALL).findall(episodeListSegment, re.DOTALL)
        print episodeInfo

        # season number
        season=re.compile('<h2>Full Episodes.+?(\d+)</span>').findall(episodeListSegment)[0]
        print season

        # add first page worth of episodes
        for watchURL, title, thumbnail, episode in episodeInfo:
            plot = ''
            # build s0xe0y season/episode header if wanted; includes trailing space!
            seasonEpisodeHeader=('', "s%02de%03d " % (int(season), int(episode)))[common.settings['show_epi_labels']]
            # see if we want plots
            plot=('', common.cleanNames(plot))[common.settings['get_episode_plot']]
            common.addDirectory(common.cleanNames(seasonEpisodeHeader + title), watchURL, 'TV_play_nbc', thumbnail, thumbnail, common.args.fanart, plot, 'genre')

        # now loop through rest of episode pages, if any; skip the first page

        # TODO: see if we can consolidate the code from episodeListSegment down,
        # as it duplicates the first page stuff above

        if pages:
            for page in pages[1:]:
                content=common.getHTML(common.NBC_BASE_URL + page)

                # get episode list per page
                episodeListSegment=re.search('<div class="scet-gallery-content">.+?</div><!-- item list -->', content, re.DOTALL).group(0)

                # title, thumbnail, watchURL, episode, plot
                episodeInfo=re.compile('<li class="list_full_detail_horiz" >.+?href="(.+?)".+?title="(.+?)"><img src="(.+?)".+?<strong>.+?Ep\. (\d+):.+?</div>.+?</li>', re.DOTALL).findall(episodeListSegment, re.DOTALL)

                # add each add'l page worth of episodes
                for watchURL, title, thumbnail, episode in episodeInfo:
                    plot = ''
                    # build s0xe0y season/episode header if wanted; includes trailing space!
                    seasonEpisodeHeader=('', "s%02de%03d " % (int(season), int(episode)))[common.settings['show_epi_labels']]
                    # see if we want plots
                    plot=('', common.cleanNames(plot))[common.settings['get_episode_plot']]
                    common.addDirectory(common.cleanNames(seasonEpisodeHeader + title), watchURL, 'TV_play_nbc', thumbnail, thumbnail, common.args.fanart, plot, 'genre')
    def addMoviesList( self ):
        
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_GENRE)

        html=common.getHTML(common.args.url)
        tree=BeautifulSoup(html)
        movies=tree.findAll('a', attrs={"class":"show-thumb info_hover"})
        del html
        del tree
        # with clips
        for movie in movies:
            name  = movie.contents[0].replace('&quot;','"').replace('&amp;','&')
            url   = movie['href']
            tmp   = movie['href'].split('/')[3]
            thumb = "http://assets.hulu.com/shows/show_thumbnail_"+tmp.replace('-','_')+".jpg"
            icon  = "http://assets.hulu.com/shows/show_thumbnail_"+tmp.replace('-','_')+".jpg"
            art   = "http://assets.hulu.com/shows/key_art_"+tmp.replace('-','_')+".jpg"
            if common.settings['get_movie_plot'] == True:
                json = common.getHTML("http://www.hulu.com/shows/info/"+tmp)
                try:
                    #this needs better regex, or maybe some sort of json parser
                    p = re.compile('description: "(.+?)"[,}]')
                    match = p.findall(json)
                    plot = match[0].replace('\\','')
                except:
                    plot=xbmc.getLocalizedString(30090)
                try:
                    p = re.compile('channel: "(.+?)"[,}]')
                    match = p.findall(json)
                    genre = match[0]
                except:
                    genre=xbmc.getLocalizedString(30090)
                #hopefully deleting this will help with xbox memory problems
                del json
            else:
                plot=genre=xbmc.getLocalizedString(30090)
            try:
                if movie.parent['class'] != "full-movie-icon":
                    name += ' '+xbmc.getLocalizedString(30091)
                    genre = xbmc.getLocalizedString(30091)+' '+genre
                elif common.args.url != common.BASE_MOVIE_URL:
                    common.addDirectory(name, url, "Movie_Items", art, icon, art, plot, genre)
            except:
                name += ' '+xbmc.getLocalizedString(30091)
                genre += ' '+xbmc.getLocalizedString(30091)
                if common.settings['only_full_movies'] == False:
                    common.addDirectory(name, url, "Movie_Items", art, icon, art, plot, genre)
                    
        #if we're doing both clips & full movies, we need to run through the function again.
        if common.args.url == common.BASE_MOVIE_URL :
            common.args.url = common.BASE_FULLMOVIE_URL
            self.addMoviesList()
Esempio n. 7
0
    def addEpisodeList( self ):

        print " \n\n adding episodes \n\n"
        
        content=common.getHTML(common.args.url)
        
        # get list of pages of additional episodes, if we have any
        try:
            pagesSegment=re.search('div class="nbcu_pager".+?class="nbcu_pager_last">', content, re.DOTALL).group(0)
            pages=common.unique(re.compile('<a href="(.+?)"').findall(pagesSegment))
        except:
            pages=None

        # get episode list per page
        episodeListSegment=re.search('<div id="browse_container">.+?</div><!-- #browse_container -->', content, re.DOTALL).group(0)
        
        # title, thumbnail, watchURL, episode, plot
        episodeInfo=re.compile('<li class="list_full_detail">.+?title="(.+?)"><img src="(.+?)".+?<a href="(.+?)".+?<strong>Ep\. (\d+):.+?<p class="list_full_des"><em>(.+?)</em>', re.DOTALL).findall(episodeListSegment, re.DOTALL)
        
        # season number
        season=re.compile('<h2>Full Episodes.+?(\d+)</span>').findall(episodeListSegment)[0]
        
        # add first page worth of episodes
        for title, thumbnail, watchURL, episode, plot in episodeInfo:
            # build s0xe0y season/episode header if wanted; includes trailing space!
            seasonEpisodeHeader=('', "s%02de%03d " % (int(season), int(episode)))[common.settings['show_epi_labels']]
            # see if we want plots
            plot=('', common.cleanNames(plot))[common.settings['get_episode_plot']]
            common.addDirectory(common.cleanNames(seasonEpisodeHeader + title), watchURL, 'TV_play_nbc', thumbnail, thumbnail, common.args.fanart, plot, 'genre')

        # now loop through rest of episode pages, if any; skip the first page
        
        # TODO: see if we can consolidate the code from episodeListSegment down,
        # as it duplicates the first page stuff above
        
        if pages:
            for page in pages[1:]:
                content=common.getHTML(common.NBC_BASE_URL + page)
                
                # get episode list per page
                episodeListSegment=re.search('<div id="browse_container">.+?</div><!-- #browse_container -->', content, re.DOTALL).group(0)
                
                # title, thumbnail, watchURL, episode, plot
                episodeInfo=re.compile('<li class="list_full_detail">.+?title="(.+?)"><img src="(.+?)".+?<a href="(.+?)".+?<strong>Ep\. (\d+):.+?<p class="list_full_des"><em>(.+?)</em>', re.DOTALL).findall(episodeListSegment, re.DOTALL)
                
                # add each add'l page worth of episodes
                for title, thumbnail, watchURL, episode, plot in episodeInfo:
                    # build s0xe0y season/episode header if wanted; includes trailing space!
                    seasonEpisodeHeader=('', "s%02de%03d " % (int(season), int(episode)))[common.settings['show_epi_labels']]
                    # see if we want plots
                    plot=('', common.cleanNames(plot))[common.settings['get_episode_plot']]
                    common.addDirectory(common.cleanNames(seasonEpisodeHeader + title), watchURL, 'TV_play_nbc', thumbnail, thumbnail, common.args.fanart, plot, 'genre')
Esempio n. 8
0
def playRTMP():
    
    vid=re.compile('id=(\d+)').findall(common.args.url)[0]
    
    smilurl = getsmil(vid)
    rtmpurl = str(getrtmp())
    swfUrl = getswfUrl()
    link = str(common.getHTML(smilurl))
    
    match=re.compile('<video src="(.+?)"').findall(link)
    if (common.settings['quality'] == '0'):
            dia = xbmcgui.Dialog()
            ret = dia.select(xbmc.getLocalizedString(30004), [xbmc.getLocalizedString(30016),xbmc.getLocalizedString(30017),xbmc.getLocalizedString(30018)])
            if (ret == 2):
                    return
    else:        
            ret = None
    for playpath in match:
        playpath = playpath.replace('.flv','')
        if '_0700' in playpath and (xbmcplugin.getSetting(pluginhandle,"quality") == '1' or '_0700' in playpath and (ret == 0)):
            item=xbmcgui.ListItem(common.args.name, iconImage='', thumbnailImage='')
            item.setInfo( type="Video",infoLabels={ "Title": common.args.name})
            item.setProperty("SWFPlayer", swfUrl)
            item.setProperty("PlayPath", playpath)
        elif '_0500' in playpath and (xbmcplugin.getSetting(pluginhandle,"quality") == '2') or '_0500' in playpath and (ret == 1):
            item=xbmcgui.ListItem(common.args.name, iconImage='', thumbnailImage='')
            item.setInfo( type="Video",infoLabels={ "Title": common.args.name})
            item.setProperty("SWFPlayer", swfUrl)
            item.setProperty("PlayPath", playpath)
    xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(rtmpurl, item)
Esempio n. 9
0
def Resolve(html):
    if not 'movieweb' in html:
        return []

    ret = None
    text = ''
    try:
        id = re.compile('http://www.movieweb.com/v/(.+?)"').search(html).group(
            1)
        url = 'http://www.movieweb.com/v/%s/play?s=1&idx=0&e=1' % id
        html = common.getHTML(url, useCache=False)

        jsn = json.loads(html)

        url = str(jsn['url_img']).split('.img', 1)[0]
        url += '/'
        url += jsn['videoId']
        url += '_'
        url += str(jsn['ii'])  #might be i
        url += jsn['iii']
        url += '?'
        url += jsn['iiii']
        ret = url
    except Exception, e:
        print str(e)
        raise
        text = 'Error Resolving Movieweb URL'
Esempio n. 10
0
def getInfo(item, params, src):
    src = enc.smart_unicode(src).encode('utf-8')
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    paramPage = urllib.unquote(paramPage)
    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    form_data = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')

    try:
        parts = (paramPage.split('|', 1) + [None] * 2)[:2]
        paramPage, form_data = parts
        form_data = urlparse.parse_qsl(form_data)
    except: 
        pass

    data = common.getHTML(paramPage, form_data, referer, referer!='',demystify=True)
    return reg.parseText(data, paramRegex, variables)
Esempio n. 11
0
def playRTMP():
    
    vid=re.compile('id=(\d+)').findall(common.args.url)[0]
    
    smilurl = getsmil(vid)
    rtmpurl = str(getrtmp())
    swfUrl = getswfUrl()
    link = str(common.getHTML(smilurl))
    
    match=re.compile('<video src="(.+?)"').findall(link)
    if (common.settings['quality'] == '0'):
            dia = xbmcgui.Dialog()
            ret = dia.select(xbmc.getLocalizedString(30004), [xbmc.getLocalizedString(30016),xbmc.getLocalizedString(30017),xbmc.getLocalizedString(30018)])
            if (ret == 2):
                    return
    else:        
            ret = None
    for playpath in match:
        playpath = playpath.replace('.flv','')
        if '_0700' in playpath and (xbmcplugin.getSetting("quality") == '1' or '_0700' in playpath and (ret == 0)):
            item=xbmcgui.ListItem(common.args.name, iconImage='', thumbnailImage='')
            item.setInfo( type="Video",infoLabels={ "Title": common.args.name})
            item.setProperty("SWFPlayer", swfUrl)
            item.setProperty("PlayPath", playpath)
        elif '_0500' in playpath and (xbmcplugin.getSetting("quality") == '2') or '_0500' in playpath and (ret == 1):
            item=xbmcgui.ListItem(common.args.name, iconImage='', thumbnailImage='')
            item.setInfo( type="Video",infoLabels={ "Title": common.args.name})
            item.setProperty("SWFPlayer", swfUrl)
            item.setProperty("PlayPath", playpath)
    xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(rtmpurl, item)
Esempio n. 12
0
    def addSeasonList( self ):
        tree=MinimalSoup(common.getHTML(common.args.url))  
        seasons=tree.findAll('td', attrs={"class":re.compile('^vex')})
        #flatten seasons by settings
        if common.settings['flat_season'] == 1 or (len(seasons) == 1 and common.settings['flat_season'] == 0):
            common.args.mode='TV_Episodes'
            seasonNums=[]
            for season in seasons:
                common.args.name = season.contents[0]
                seasonNums.append(season.contents[0])
                self.addEpisodeList( )
            #add clips folder
            rss=tree.findAll('a', attrs={'class':'rss-link'})
            clipRSS = None
            for feed in rss:
                if feed['href'].split('/')[-1]=='clips':
                    clipRSS = feed['href']
            if clipRSS != None:
                common.addDirectory(xbmc.getLocalizedString(30095), clipRSS, "TV_Clips")
            xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))

        else:
            #add one folder for each season
            for season in seasons:
                name=season.contents[0]
                p=re.compile('&quot;(http://.+?)&quot;')
                url=p.findall(season['onclick'])
                url=url[0].replace('&amp;','&')
                ok=common.addDirectory(name, common.args.url, "TV_Episodes")
            #add clips folder
            rss=tree.findAll('a', attrs={'class':'rss-link'})
            for feed in rss:
                if feed['href'].split('/')[-1]=='clips': clipRSS = feed['href']
            common.addDirectory(xbmc.getLocalizedString(30095), clipRSS, "TV_Clips")
            xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))
Esempio n. 13
0
def Resolve(html):
    if not "movieweb" in html:
        return []

    ret = None
    text = ""
    try:
        id = re.compile('http://www.movieweb.com/v/(.+?)"').search(html).group(1)
        url = "http://www.movieweb.com/v/%s/play?s=1&idx=0&e=1" % id
        html = common.getHTML(url, useCache=False)

        jsn = json.loads(html)

        url = str(jsn["url_img"]).split(".img", 1)[0]
        url += "/"
        url += jsn["videoId"]
        url += "_"
        url += str(jsn["ii"])  # might be i
        url += jsn["iii"]
        url += "?"
        url += jsn["iiii"]
        ret = url
    except Exception, e:
        print str(e)
        raise
        text = "Error Resolving Movieweb URL"
Esempio n. 14
0
def ResolveURL(url):
    #print url
    #url = 'http://www.watchcartoononline.com/axis-powers-hetalia-episode-46-english-subbed' #vweed
    #url = 'http://www.watchcartoononline.com/halo-legends-episode-8-english-dubbed' #veoh
    #url = 'http://www.watchcartoononline.com/american-dad-season-1-episode-20-roger-n-me'#cizgifilmlerizle
    #url = 'http://www.watchcartoononline.com/adventures-of-sonic-the-hedgehog-episode-66-sonic-christmas-blast' #Youtube
    #url = 'http://www.watchcartoononline.com/tmnt-season-7-episode-13-wedding-bells-and-bytes' #Youtube 2 PARTS
    #url = 'http://www.watchcartoononline.com/thundercats-2011-premiere' #movieweb
    #url = 'http://www.watchcartoononline.com/hacklegend-of-the-twilight-episode-12-english-dubbed'
    #url = 'http://www.watchcartoononline.com/mr-bean-the-animated-series-episode-49-in-the-pink' #YouTube GEOLOCKED embeded

    ImportModules()

    html = common.getHTML(url)

    url = None
    msg = None

    resolved = []

    match = re.compile('<div class=\'postTabs_divs(.+?)</div>').findall(html)

    for item in match:
        for module in MODULES:
            items = MODULES[module].Resolve(item)
            for item in items:
                if item[0] != None:
                    resolved.append(
                        [module.replace('_', ''), item[0], item[1]])

    return resolved
Esempio n. 15
0
    def addListings ( self ):
        xmlsoup = BeautifulStoneSoup(common.getHTML( common.args.url ))
        items = xmlsoup.findAll('item')
        for item in items:
            name = item.title.contents[0]
            url  = item.guid.contents[0]
            try:
                try:
                    p = re.compile('&lt;p&gt;(.+?)&lt;/p&gt;')
                    plot = p.findall(item.description.contents[0])[0]
                except:
                    p = re.compile('<p>(.+?)</p>')
                    plot = p.findall(str(item.description))[0]
            except:
                plot = 'Unavaliable'
            try:
                p = re.compile('media:thumbnail.+?url="(.+?)"')
                thumb = p.findall(str(item))[0]
            except:
                thumb = ''
            try:
                fanart = 'http://assets.hulu.com/shows/key_art_'+name.split(':')[0].replace('-','_').replace(' ','_').replace('\'','').replace('"','').lower()+'.jpg'
            except:
                fanart = ''

            genre = common.args.name

            if common.args.name == 'Recently Added Shows':
                common.addDirectory(name, url, 'RSS_Shows', thumb, thumb, fanart, plot, genre)
            else:
                common.addDirectory(name, url, 'RSS_play', thumb, thumb, fanart, plot, genre)
Esempio n. 16
0
def ResolveURL(url):
    # print url
    # url = 'http://www.watchcartoononline.com/axis-powers-hetalia-episode-46-english-subbed' #vweed
    # url = 'http://www.watchcartoononline.com/halo-legends-episode-8-english-dubbed' #veoh
    # url = 'http://www.watchcartoononline.com/american-dad-season-1-episode-20-roger-n-me'#cizgifilmlerizle
    # url = 'http://www.watchcartoononline.com/adventures-of-sonic-the-hedgehog-episode-66-sonic-christmas-blast' #Youtube
    # url = 'http://www.watchcartoononline.com/tmnt-season-7-episode-13-wedding-bells-and-bytes' #Youtube 2 PARTS
    # url = 'http://www.watchcartoononline.com/thundercats-2011-premiere' #movieweb
    # url = 'http://www.watchcartoononline.com/hacklegend-of-the-twilight-episode-12-english-dubbed'
    # url = 'http://www.watchcartoononline.com/mr-bean-the-animated-series-episode-49-in-the-pink' #YouTube GEOLOCKED embeded

    ImportModules()

    html = common.getHTML(url)
    html = html.replace('"Click Here!!"</a></div>', "")

    url = None
    msg = None

    resolved = []

    match = re.compile("<div class='postTabs_divs(.+?)</div>").findall(html)

    for item in match:
        for module in MODULES:
            items = MODULES[module].Resolve(item)
            for item in items:
                if item[0] != None:
                    resolved.append([module.replace("_", ""), item[0], item[1]])

    return resolved
Esempio n. 17
0
def DoSection(url):
    mode = SERIES
    if url == 'http://www.watchcartoononline.com/movie-list':
        mode = EPISODE
    if url == 'http://www.watchcartoononline.com/ova-list':
        mode = EPISODE

    html = common.getHTML(url)

    html = html.split('<div id="ddmcc_container">', 1)[-1]

    html = html.replace('<li><a href=""></a></li>', '')
  
    names = []

    match = re.compile('<li><a href="(.+?)">(.+?)</a></li>').findall(html)

    sorted = []

    for url, name in match:
        if ('#' not in url) and ('title="' not in url):
            if name not in names:
                names.append(name)
                if mode == SERIES:
                    newName = name
                    if newName.startswith('The '):
                        newName = newName.split('The ', 1)[-1]
                    sorted.append([newName, name, url])
                elif mode == EPISODE:
                    AddEpisode(name, url)

    sorted.sort()
    for item in sorted:
        AddSeries(item[1], item[2])
def getInfo(item, params, src):
    src = enc.smart_unicode(src).encode('utf-8')
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    form_data = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')

    try:
        parts = (paramPage.split('|', 1) + [None] * 2)[:2]
        paramPage, form_data = parts
        form_data = urlparse.parse_qsl(form_data)
    except: 
        pass

    data = common.getHTML(paramPage, form_data, referer, referer!='',demystify=True)
    return reg.parseText(data, paramRegex, variables)
Esempio n. 19
0
def DoSection(url):
    mode = SERIES
    if url == 'http://www.watchcartoononline.com/movie-list':
        mode = EPISODE
    if url == 'http://www.watchcartoononline.com/ova-list':
        mode = EPISODE

    html = common.getHTML(url)

    html = html.split('<div id="ddmcc_container">', 1)[-1]

    html = html.replace('<li><a href=""></a></li>', '')

    names = []

    match = re.compile('<li><a href="(.+?)">(.+?)</a></li>').findall(html)

    sorted = []

    for url, name in match:
        if ('#' not in url) and ('title="' not in url):
            if name not in names:
                names.append(name)
                if mode == SERIES:
                    newName = name
                    if newName.startswith('The '):
                        newName = newName.split('The ', 1)[-1]
                    sorted.append([newName, name, url])
                elif mode == EPISODE:
                    AddEpisode(name, url)

    sorted.sort()
    for item in sorted:
        AddSeries(item[1], item[2])
Esempio n. 20
0
def getInfo(item, params, src):
    src = enc.smart_unicode(src).encode('utf-8')
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    paramPage = urllib.unquote(paramPage)
    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')
    data = common.getHTML(paramPage, referer, referer!='')
    return reg.parseText(data, paramRegex, variables)
Esempio n. 21
0
def getInfo(item, params, src):
    src = enc.smart_unicode(src).encode('utf-8')
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    paramPage = urllib.unquote(paramPage)
    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    
    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))
        
    referer = ''
    variables=[]
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')
    common.log('Get Info from: "'+ paramPage + '" from "' + referer + '"')
    data = common.getHTML(paramPage, referer, referer!='')
    return reg.parseText(data, paramRegex, variables)
Esempio n. 22
0
def Resolve(html):
    if not 'movieweb' in html:
        return []

    ret  = None
    text = ''
    try:
        id   = re.compile('http://www.movieweb.com/v/(.+?)"').search(html).group(1)
        url  = 'http://www.movieweb.com/v/%s/play?s=1&idx=0&e=1' % id
        html = common.getHTML(url, useCache=False)
        
        jsn = json.loads(html)

        url = str(jsn['url_img']).split('.img', 1)[0]
        url += '/'
        url += jsn['videoId']
        url += '_'
        url += str(jsn['ii']) #might be i
        url += jsn['iii']
        url += '?'
        url += jsn['iiii']
        ret  = url
    except Exception, e:
        print str(e)
        raise
        text = 'Error Resolving Movieweb URL'
Esempio n. 23
0
 def CHECKSEASONS(self, showid):
     #Seasons
     url = "http://www.cbs.com/sitefeeds" + showid + "seasons.js"
     if self.TESTURL(url) == True:
         link = common.getHTML(url)
         match = re.compile('var categoryCount = (.+?);').findall(link)
         seasons = int(match[0])
         return seasons
Esempio n. 24
0
 def addVideosList( self ):
     if '(clips only)' in common.args.name:
         self.addClipsList()
     else:
         tree=BeautifulSoup(common.getHTML(common.args.url))
         link=tree.find('a', attrs={"class":'info_hover'})
         movieUrl = link['href']
         common.addDirectory(common.args.name, movieUrl, "Movie_play", common.args.fanart, common.args.fanart, common.args.fanart, common.args.plot, common.args.genre)
         common.addDirectory(xbmc.getLocalizedString(30092)+' '+common.args.name.replace(xbmc.getLocalizedString(30091),''), common.args.url, 'Movie_Clips', common.args.fanart,common.args.fanart,common.args.fanart)
Esempio n. 25
0
    def addEpisodeList( self ):

        print " \n\n adding episodes \n\n"
        
        content=common.getHTML(common.args.url)

        # get the RSS feed URL and slurp it
        rssURL=re.compile('var _rssURL = "(.+?)";').findall(content)[0].replace('%26','&')
        content=common.getHTML(rssURL)
        
        # title, watchURL, plot, thumbnail
        episodeInfo=re.compile('<item>.+?<title>.+?CDATA\[(.+?)\].+?<link>(.+?id=\d+).+?</link>.+?<description>.+?CDATA\[(.+?)\].+?thumbnail.+?url="(.+?)"', re.DOTALL).findall(content, re.DOTALL)
        
        # add episodes
        for title, watchURL, plot, thumbnail in episodeInfo:
            # see if we want plots
            plot=('', common.cleanNames(plot))[common.settings['get_episode_plot']]
            common.addDirectory(common.cleanNames(title), watchURL, 'TV_play_usa', thumbnail, thumbnail, common.args.fanart, plot, 'genre')
Esempio n. 26
0
 def addEpisodeList( self ):
     #initialize variables
     p=re.compile('(\d+)')#gets last number from "season ##"
     currentSeason=p.findall(common.args.name)[0]
     epRSS=None
     #parse html tree
     tree=MinimalSoup(common.getHTML(common.args.url))
     rss=tree.findAll('a', attrs={'class':'rss-link'})
     for feed in rss:
         if feed['href'].split('/')[-1]=='episodes':
             tree=BeautifulStoneSoup(common.getHTML(feed['href']))
             items=tree.findAll('item')
             for episode in items:
                 p=re.compile('\(s([0-9]*).+?\|.+?e([0-9]*)\)')
                 match=p.findall(episode.title.contents[0])[0]
                 seasonNum  = match[0]
                 episodeNum = match[1]
                 if seasonNum == currentSeason:
                     #add this episode to list
                     name    = episode.title.contents[0].split('(')[0]
                     if len(seasonNum)<2:seasonNum='0'+seasonNum
                     if len(episodeNum)<2:episodeNum='0'+episodeNum
                     name = 's'+seasonNum+'e'+episodeNum+' '+name
                     url = episode.link.contents[0].split('#')[0]
                     try:
                         thumb = episode.findAll('media:thumbnail')[0]['url']
                     except:
                         thumb = ''
                     try:
                         airdate = episode.pubdate.contents[0]
                     except:
                         airdate = ''
                     try:
                         p=re.compile('<p>(.+?)</p>.+?Added: ')
                         plot =''.join(p.findall(str(episode.findAll('description'))))
                         try:
                             p=re.compile('Duration: (.+?)\n')
                             duration=p.findall(plot)[0].split(':')
                             duration=(int(duration[0])*60)+int(duration[1])
                         except:
                             duration=1
                     except:
                         plot = ''
                     common.addDirectory(name,url,'TV_play', thumb, thumb, common.args.fanart, plot, 'genre')
Esempio n. 27
0
    def LISTSHOWS(self, cat):
        url = common.ALL_SHOWS_URL
        link = common.getHTML(url)
        match = re.compile(
            '<a href="(.+?)" class="shows" target="_parent">(.+?)<').findall(
                link)
        for url, name in match:
            thumb = "http://www.cbs.com" + url + "images/common/show_logo.gif"
            #Clean names
            name = name.replace("<br>", " ").replace("&reg", "")
            #Ignore badshow links & showids
            if "http://" in url:
                pass
            elif "/daytime/" == url:
                pass
            elif "/primetime/survivor/fantasy/" == url:
                pass
            else:
                #Fix late show showid & thumb
                if "/latenight/lateshow/" == url:
                    url = "/late_show/"
                    thumb = "http://www.cbs.com" + url + "images/common/show_logo.gif"
                #Fix crimetime thumb
                elif "/crimetime/" == url:
                    thumb = "http://www.cbs.com" + url + "images/common/show_logo.png"
                #Fix 48 Hours and Victorias Secret thumb
                elif "/primetime/48_hours/" == url or "/specials/victorias_secret/" == url:
                    thumb = "http://www.cbs.com" + url + "images/common/show_logo.jpg"
                elif "/primetime/big_brother/housecalls/" == url:
                    thumb = "http://www.cbs.com" + "/primetime/big_brother/" + "images/common/show_logo.gif"
                #Blank icons for unavailable
                elif "/primetime/flashpoint/" == url or "/primetime/game_show_in_my_head/" == url or "/specials/grammys/lincoln/" == url:
                    thumb = xbmc.translatePath(
                        os.path.join(common.imagepath,
                                     url.replace('/', '') + ".png"))

                #Plot cache file
                plotfile = xbmc.translatePath(
                    os.path.join(common.cachepath,
                                 url.replace('/', '') + ".txt"))
                #Check for show info cache file
                if os.path.isfile(plotfile):
                    f = open(plotfile, 'r')
                    plot = f.read()
                    f.close()
                #No Plot
                else:
                    plot = 'No Plot Information Available'
                #All Categories
                if cat == "all":
                    common.addDirectory(name, url, 'List', thumb, thumb, plot)
                #Selected Categories
                elif cat in url:
                    common.addDirectory(name, url, 'List', thumb, thumb, plot)

        xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
Esempio n. 28
0
def getSource(params, src):
    paramPage = ''
    paramReferer = ''
    if params.find('\',\'') > -1:
        paramPage, paramReferer = __parseParams(params)
    else:
        paramPage = params.strip('\',\'')

    paramPage = paramPage.replace('%s', src)
    return common.getHTML(paramPage, None, paramReferer)
Esempio n. 29
0
def getSource(params, src):
    paramPage = ''
    paramReferer = ''
    if params.find('\',\'') > -1:
        paramPage, paramReferer = __parseParams(params)
    else:
        paramPage = params.strip('\',\'')

    paramPage = paramPage.replace('%s', src)
    return common.getHTML(paramPage,paramReferer)
Esempio n. 30
0
    def HDSHOWS(self, url):
        link = common.getHTML(url)
        hdcachefile = xbmc.translatePath(
            os.path.join(common.cachepath, "hd.js"))
        f = open(hdcachefile, 'w')
        plot = f.write(str(link))
        f.close()
        match = re.compile('videoProperties(.+?);\r').findall(link)
        SHOWLIST = ['']
        CLIPLIST = ['']
        EPISODELIST = ['']
        #set List Counter to 1 for popular and recent shows
        for url in match:
            breakurl = url.split("','")
            SHOWNAME = breakurl[3]
            if SHOWNAME <> '':
                Episodes = False
                Clips = False
                if len(breakurl[9]) > 4:
                    Episodes = True
                if len(breakurl[9]) <= 4:
                    Clips = True
                if SHOWLIST[0] == '':
                    #print "first run"
                    SHOWLIST[0] = SHOWNAME
                    EPISODELIST[0] = Episodes
                    CLIPLIST[0] = Clips
                elif SHOWNAME in SHOWLIST:
                    #print "existing show"
                    i = SHOWLIST.index(SHOWNAME)
                    if Episodes == True:
                        EPISODELIST[i] = Episodes
                    elif Clips == True:
                        CLIPLIST[i] = Clips
                else:
                    #print "New Show"
                    SHOWLIST.append(SHOWNAME)
                    EPISODELIST.append(Episodes)
                    CLIPLIST.append(Clips)
            else:
                print "NO SHOW NAME: " + breakurl

        #for SHOWNAME,Episodes,Clips in SHOWLIST:
        for SHOWNAME in SHOWLIST:
            i = SHOWLIST.index(SHOWNAME)
            Episodes = EPISODELIST[i]
            Clips = CLIPLIST[i]
            if Episodes == True and Clips == True:
                common.addDirectory(SHOWNAME, 'EpisodesClips', 'ListHD')
            elif Episodes == True:
                common.addDirectory(SHOWNAME, 'Episodes', 'ListHD')
            elif Clips == True:
                common.addDirectory(SHOWNAME, "Clips", "ListHD")

        xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
Esempio n. 31
0
def DoResolve(url):

    ret  = None
    text = ''
    try:        
        theNet = net.Net()

        data = {'fuck_you' : '', 'confirm' : 'Close%20Ad%20and%20Watch%20as%20Free%20User'}
        url  = url.replace(' ', '%20')

        theNet.set_user_agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')

        html  = theNet.http_POST(url, data).content

        try:
            url  = re.compile('iframe src=\"(.+)\" frameborder').search(html).group(1)
            html = common.getHTML(url)
            url  = re.compile('file: \"(.+)\",\\r  height').search(html).group(1)
            
        except:
            url  = re.compile('410px\\\' src=\\\'(.+)\\\' scrolling').search(html).group(1)
            html = common.getHTML(url)

            url  = re.compile('advURL=\"(.+)\";flashvars.cid3').search(html).group(1)
            html = common.getHTML(url)

            flashfile = re.compile('flashvars.file=\"(.+)\";').search(html).group(1).split('"')[0]           
            flashkey  = re.compile('flashvars.filekey=\"(.+)\";').search(html).group(1).split('"')[0]
            
            url  = 'http://www.videoweed.es/api/player.api.php?file='+flashfile+'&key='+flashkey.replace(".","%2E").replace("-","%2D")
            html = theNet.http_GET(url,headers = { 'Referer' : 'http://www.videoweed.es/player/cloudplayer.swf' , 'Host' : 'www.videoweed.es'}).content
            url  = re.compile('url=(.+\.flv)&title=').search(html).group(1)
            
            domain  = re.compile('http://(.+)/.+').search(url).group(1).split('/')[0]
            url    += '?client=FLASH|Host='+domain+'&User-Agent=Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0&Accept=application/octet-stream,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&Referer=http://www.videoweed.es/player/cloudplayer.swf&Connection=keep-alive'
               
        url = url.replace(' ', '%20')
        ret = url       
    except:
        text = 'Error Resolving URL'

    return [[ret, text]]
Esempio n. 32
0
    def __findRedirect(self, page, referer='', demystify=False):
        data = common.getHTML(page, referer = referer, demystify = demystify)

        link = findVideoFrameLink(page, data)
        if link:
            return link

        if not demystify:
            return self.__findRedirect(page, referer, True)

        return page
Esempio n. 33
0
def Main():
    CheckVersion()

    html = common.getHTML(URL)

    match = re.compile('<li><a href="(.+?)">(.+?)</a></li>').findall(html)
    for url, name in match:
        if name == 'Contact':
            break
        if name != 'Home':
            AddSection(name, '', url)
Esempio n. 34
0
    def HDSHOWS(self, url):
        link = common.getHTML(url)
        hdcachefile = xbmc.translatePath(os.path.join(common.cachepath, "hd.js"))
        f = open(hdcachefile, "w")
        plot = f.write(str(link))
        f.close()
        match = re.compile("videoProperties(.+?);\r").findall(link)
        SHOWLIST = [""]
        CLIPLIST = [""]
        EPISODELIST = [""]
        # set List Counter to 1 for popular and recent shows
        for url in match:
            breakurl = url.split("','")
            SHOWNAME = breakurl[3]
            if SHOWNAME <> "":
                Episodes = False
                Clips = False
                if len(breakurl[9]) > 4:
                    Episodes = True
                if len(breakurl[9]) <= 4:
                    Clips = True
                if SHOWLIST[0] == "":
                    # print "first run"
                    SHOWLIST[0] = SHOWNAME
                    EPISODELIST[0] = Episodes
                    CLIPLIST[0] = Clips
                elif SHOWNAME in SHOWLIST:
                    # print "existing show"
                    i = SHOWLIST.index(SHOWNAME)
                    if Episodes == True:
                        EPISODELIST[i] = Episodes
                    elif Clips == True:
                        CLIPLIST[i] = Clips
                else:
                    # print "New Show"
                    SHOWLIST.append(SHOWNAME)
                    EPISODELIST.append(Episodes)
                    CLIPLIST.append(Clips)
            else:
                print "NO SHOW NAME: " + breakurl

        # for SHOWNAME,Episodes,Clips in SHOWLIST:
        for SHOWNAME in SHOWLIST:
            i = SHOWLIST.index(SHOWNAME)
            Episodes = EPISODELIST[i]
            Clips = CLIPLIST[i]
            if Episodes == True and Clips == True:
                common.addDirectory(SHOWNAME, "EpisodesClips", "ListHD")
            elif Episodes == True:
                common.addDirectory(SHOWNAME, "Episodes", "ListHD")
            elif Clips == True:
                common.addDirectory(SHOWNAME, "Clips", "ListHD")

        xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
Esempio n. 35
0
def Main():
    CheckVersion()

    html = common.getHTML(URL)

    match = re.compile('<li><a href="(.+?)">(.+?)</a></li>').findall(html)
    for url, name in match:
        if name == 'Contact':
            break
        if name != 'Home':
            AddSection(name, '', url)
Esempio n. 36
0
 def getAds( self, link):
     stripurl = re.compile('<ref src="ad.doubleclick.net(.+?)" ').findall(link)
     ads = ['']
     stripurl[0] = 'http://www.cbs.com/thunder/ad.doubleclick.net' + stripurl[0].replace('PARTNER','cbs')
     for url in stripurl:
         url = 'http://www.cbs.com/thunder/ad.doubleclick.net' + stripurl[0].replace('PARTNER','cbs')
         link=common.getHTML(url)
         adsurl = re.compile('src="(.+?)"').findall(link)
         adtrack = re.compile('tp:trackingURLs="0%;(.+?)"').findall(link)
         ads.apend(url)
     return ads
Esempio n. 37
0
def getSource(params, src):
    paramPage = ''
    paramReferer = ''
    if params.find('\',\'') > -1:
        paramPage, paramReferer = __parseParams(params)
    else:
        paramPage = params.strip('\',\'')

    paramPage = paramPage.replace('%s', src)
    data = common.getHTML(paramPage, None, paramReferer)
    #common.log('JairoXGetSource:' + data)
    return data
Esempio n. 38
0
    def addClipsList( self ):
        
        print " \n\n adding clips \n\n"

        content=common.getHTML(common.args.url)
        
        # watchURL, thumbnail, title
        clipInfo=re.compile('<li>.+?<a href="(.+?)".+?<img src="(.+?)".+?alt="(.+?)".+?</li>').findall(content)

        for watchURL, thumbnail, title in clipInfo:
            # see if we want plots
            if common.settings['get_episode_plot']:
                episodeInfoID=re.compile('http://www.hulu.com/watch/(\d+)/').findall(watchURL)[0]
                content=common.getHTML("http://www.hulu.com/videos/info/%s" % (episodeInfoID))
                # only getting description for now; info page also includes:
                #  programming_type, rating, has_captions, episode_number, show_name, title, air_date, content_rating, thumbnail_url, season_number, duration
                plot=repr(re.compile('description: "(.+?)"').findall(content)[0].replace('\n', '\r'))
            else:
                plot=''
            common.addDirectory(common.cleanNames(title), watchURL, 'TV_Clips_play_nbc', thumbnail, thumbnail, common.args.fanart, plot, 'genre')
        del content
Esempio n. 39
0
def getSource(params, src):
    paramPage = ''
    paramReferer = ''
    if params.find('\',\'') > -1:
        paramPage, paramReferer = __parseParams(params)
    else:
        paramPage = params.strip('\',\'')
    common.log('#getSourcefrom: "'+ paramPage + '" from "' + paramReferer + '"')
    paramPage = paramPage.replace('%s', src)
    alina =  common.getHTML(paramPage, None, paramReferer)
    common.log('#getSource from: "'+ paramPage + '" alina"' + alina + '"')
    return alina
Esempio n. 40
0
    def addClipsList( self ):

        print " \n\n adding clips \n\n"

        content=common.getHTML(common.args.url)

        # watchURL, thumbnail, title
        clipInfo=re.compile('<li>.+?<a href="(.+?)".+?<img src="(.+?)".+?alt="(.+?)".+?</li>').findall(content)

        for watchURL, thumbnail, title in clipInfo:
            # see if we want plots
            if common.settings['get_episode_plot']:
                episodeInfoID=re.compile('http://www.hulu.com/watch/(\d+)/').findall(watchURL)[0]
                content=common.getHTML("http://www.hulu.com/videos/info/%s" % (episodeInfoID))
                # only getting description for now; info page also includes:
                #  programming_type, rating, has_captions, episode_number, show_name, title, air_date, content_rating, thumbnail_url, season_number, duration
                plot=repr(re.compile('description: "(.+?)"').findall(content)[0].replace('\n', '\r'))
            else:
                plot=''
            common.addDirectory(common.cleanNames(title), watchURL, 'TV_Clips_play_nbc', thumbnail, thumbnail, common.args.fanart, plot, 'genre')
        del content
Esempio n. 41
0
    def addShowsList( self ):

        print "\n\n adding shows \n\n"

        content=common.getHTML(common.args.url)
        
        # title, thumb, id, fanart
        shows=re.compile('<series>.+?<name>(.+?)</name>.+?<thumbnailUrl>(.+?)</thumbnailUrl>.+?<id>(\d+)</id>.+?<backgroundUrl>(.+?)</backgroundUrl>.+?</series>', re.DOTALL).findall(content, re.DOTALL)

        for title, thumb, id, fanart in shows:
            showURL="http://video.scifi.com/player/feeds/?level=%s&type=placement&showall=1" % (id)
            common.addDirectory(common.cleanNames(title), showURL, 'TV_Episodes_scifi', thumb=common.SCIFI_BASE_URL + thumb, fanart=common.SCIFI_BASE_URL + fanart)
def getSource(params, src):
    paramPage = ''
    paramReferer = ''
    if params.find('\',\'') > -1:
        paramPage, paramReferer = __parseParams(params)
    else:
        paramPage = params.strip('\',\'')

    paramPage = paramPage.replace('%s', src)
    data = common.getHTML(paramPage, None, paramReferer)
    #common.log('JairoXGetSource:' + data)
    return data
Esempio n. 43
0
 def addListings(self):
     tree = BeautifulSoup(common.getHTML(common.args.url))
     items = tree.findAll("li")
     for item in items:
         link = item.findAll("a", "info_hover")
         url = link[0]["href"]
         name = common.cleanNames(link[-1].contents[0])
         thumb = item.find("img")["src"]
         print name
         print url
         print thumb
         common.addDirectory(name, url, "HD_play", thumb, thumb)
Esempio n. 44
0
    def LISTSHOWS(self,cat):
        url = common.ALL_SHOWS_URL
        link=common.getHTML(url)
        match=re.compile('<a href="(.+?)" class="shows" target="_parent">(.+?)<').findall(link)
        for url,name in match:
                thumb = "http://www.cbs.com" + url + "images/common/show_logo.gif"
                #Clean names
                name = name.replace("<br>"," ").replace("&reg","")
                #Ignore badshow links & showids
                if "http://" in url:
                        pass
                elif "/daytime/" == url:
                        pass
                elif "/primetime/survivor/fantasy/" == url:
                        pass                       
                else:
                        #Fix late show showid & thumb
                        if "/latenight/lateshow/" == url:
                                url = "/late_show/"
                                thumb = "http://www.cbs.com" + url + "images/common/show_logo.gif"
                        #Fix crimetime thumb        
                        elif "/crimetime/" == url:
                                thumb = "http://www.cbs.com" + url + "images/common/show_logo.png"
                        #Fix 48 Hours and Victorias Secret thumb
                        elif "/primetime/48_hours/" == url or "/specials/victorias_secret/" == url:
                                thumb = "http://www.cbs.com" + url + "images/common/show_logo.jpg"
                        elif "/primetime/big_brother/housecalls/" == url:
                                thumb = "http://www.cbs.com" + "/primetime/big_brother/" + "images/common/show_logo.gif"
                        #Blank icons for unavailable
                        elif "/primetime/flashpoint/" == url or "/primetime/game_show_in_my_head/" == url or "/specials/grammys/lincoln/" == url:
                                thumb = xbmc.translatePath(os.path.join(common.imagepath,url.replace('/','') + ".png"))

                        #Plot cache file
                        plotfile = xbmc.translatePath(os.path.join(common.cachepath,url.replace('/','') + ".txt"))
                        #Check for show info cache file
                        if os.path.isfile(plotfile):
                            f = open(plotfile , 'r')
                            plot = f.read()
                            f.close()
                        #No Plot
                        else:
                            plot = 'No Plot Information Available'
                        #All Categories
                        if cat == "all":
                            common.addDirectory(name,url,'List',thumb,thumb,plot)
                        #Selected Categories
                        elif cat in url:
                            common.addDirectory(name,url,'List',thumb,thumb,plot)

        xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))
Esempio n. 45
0
    def __findRedirect(self, page, referer='', demystify=False):
        data = common.getHTML(page, None, referer=referer, xml=False, mobile=False, demystify=demystify)
        
        if findVideoFrameLink(page, data):
            return findVideoFrameLink(page, data)
        elif findContentRefreshLink(data):
            return findContentRefreshLink(data)
        elif findEmbedPHPLink(data):
            return findEmbedPHPLink(data)
            
        if not demystify:
            return self.__findRedirect(page, referer, True)

        return page
Esempio n. 46
0
 def addClipsList( self ):
     tree=BeautifulSoup(common.getHTML(common.args.url))
     rssLink = tree.find('a', attrs={'class':'rss-link'})
     if rssLink == None:
         xbmcgui.Dialog().ok(xbmc.getLocalizedString(30093),xbmc.getLocalizedString(30094)+' '+common.args.name)
     else:
         name = common.args.name.replace(xbmc.getLocalizedString(30090),'')
         tree=BeautifulStoneSoup(common.getHTML(rssLink['href']))
         clips = tree.findAll('item')
         for clip in clips:
             name = clip.title.contents[0].split(': ')[1:][0]
             url  = clip.link.contents[0].split('#')[0]
             try:
                 thumb = clip.findAll('media:thumbnail')[0]['url']
             except:
                 thumb = common.args.fanart
             try:
                 p=re.compile('<p>(.+?)</p>.+?Added: ')
                 plot =''.join(p.findall(str(clip.findAll('description')))).replace('<br />','\n').replace('Added: ','\n\nAdded: ')
             except:
                 plot = ''
             common.addDirectory(name, url, 'TV_Clips_play', thumb, thumb, common.args.fanart, plot, common.args.genre )
         xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))
Esempio n. 47
0
def PlayVideo(_url, select):
    resolved = resolve.ResolveURL(_url)

    if len(resolved) == 0:
        url = None
        msg = 'Unidentified Video Host'
    else:
        index = GetLinkIndex(resolved, select)

        if index == None:
            xbmcplugin.setResolvedUrl(int(sys.argv[1]), False,
                                      xbmcgui.ListItem(''))
            return

        resolver = resolved[index][0]
        url = resolved[index][1]
        msg = resolved[index][2]

    if url:
        url = url.split('"')[0]
        url = url.replace(' ', '%20')

    if not url:
        d = xbmcgui.Dialog()
        d.ok(TITLE + ' - ' + VERSION, '', msg, '')

        print 'WATCHCARTOONSONLINE - (%s) Failed to locate video for %s' % (
            msg, _url)
        return

    html = common.getHTML(_url)
    image = re.compile('"image_src" href="(.+?)"').search(html).group(1)
    title = re.compile('<title>(.+?)</title>').search(html).group(1).split(
        ' |', 1)[0]
    title = common.clean(title)

    liz = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image)

    liz.setInfo(type="Video", infoLabels={"Title": title})
    liz.setProperty("IsPlayable", "true")

    if int(sys.argv[1]) == -1:
        pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        pl.clear()
        pl.add(url, liz)
        xbmc.Player().play(pl)
    else:
        liz.setPath(url)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
Esempio n. 48
0
    def addShowsList( self ):

        print "\n\n adding shows \n\n"

        content=common.getHTML(common.args.url)
        
        # establish show library context
        showListSegment=re.search('<h4>Show Library</h4>.+?</ul>', content, re.DOTALL).group(0)

        # showURL, title
        shows=re.compile('<li><a href="(http://www.nbc.com/.+?/video/)">(.+?)</a></li>').findall(showListSegment, re.DOTALL)

        for showURL, title in shows:
            title=(title, title + ' (Vintage)')[showURL.find('Vintage_Shows') > 0]  # if vintage, say so
            common.addDirectory(common.cleanNames(title), showURL, 'TV_Seasons_nbc')
Esempio n. 49
0
 def TESTURL(self, url):
     link = common.getHTML(url)
     if link == False:
         return False
     else:
         #CHECKSEASONS
         if "seasons.js" in url:
             return True
         #Check for a Video count other then 0
         match = re.compile('var videoCount = (.+?);').findall(link)
         videocount = match[0]
         if videocount == '0':
             return False
         #This is a good Video list
         return True
Esempio n. 50
0
 def getAds(self, link):
     stripurl = re.compile('<ref src="ad.doubleclick.net(.+?)" ').findall(
         link)
     ads = ['']
     stripurl[
         0] = 'http://www.cbs.com/thunder/ad.doubleclick.net' + stripurl[
             0].replace('PARTNER', 'cbs')
     for url in stripurl:
         url = 'http://www.cbs.com/thunder/ad.doubleclick.net' + stripurl[
             0].replace('PARTNER', 'cbs')
         link = common.getHTML(url)
         adsurl = re.compile('src="(.+?)"').findall(link)
         adtrack = re.compile('tp:trackingURLs="0%;(.+?)"').findall(link)
         ads.apend(url)
     return ads
Esempio n. 51
0
    def __init__( self ):
        xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
        name = common.args.name
        page = common.args.page
        
        data = common.getHTML(common.args.url)
        tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)

        if page == 'optionlist':
            try:
                options = tree.find(attrs={'id' : 'secondary-show-nav-wrapper'})
                options = options.findAll('a')
                for option in options:
                    name = option.string.encode('utf-8')
                    url = common.BASE + option['href']
                    common.addDirectory(name,url,'Videos','1')
            except:
                print 'CBS: secondary-show-nav-wrapper failed'
                print 'CBS: trying vid_module'
                try:
                    options = tree.findAll(attrs={'class' : 'vid_module'})
                    for option in options:
                        moduleid = option['id']
                        name = option.find(attrs={'class' : 'hdr'}).string
                        common.addDirectory(name,common.args.url,'Videos',moduleid)                                        
                except:
                    print 'CBS: vid_module failed'
        elif page == '1':
            print 'CBS: trying vid_module'
            try:
                options = tree.findAll(attrs={'class' : 'vid_module'})
                if len(options) == 1:
                    self.PAGES(tree)
                else:
                    for option in options:
                        moduleid = option['id']
                        name = option.find(attrs={'class' : 'hdr'}).string
                        common.addDirectory(name,common.args.url,'Videos',moduleid)                                        
            except:
                self.PAGES(tree)
        elif 'vid_module' in page:
            vid_module = tree.find(attrs={'id' : page})
            self.PAGES(vid_module)
            
        if common.args.updatelist == 'true':
            xbmcplugin.endOfDirectory( pluginhandle, cacheToDisc=True, updateListing=True)
        else:
            xbmcplugin.endOfDirectory( pluginhandle, cacheToDisc=True)
Esempio n. 52
0
 def addMainHomeItems( self ):
     tvicon = xbmc.translatePath(os.path.join(common.imagepath,"tv_icon.png"))
     #Video lists
     #common.addDirectory('Most Popular','popular','Videos')
     #common.addDirectory('Latest Videos','latest','Videos')
     #common.addDirectory('Full Episodes','fullep','Videos')
     
     #Show types
     data = common.getHTML(common.BASE_URL)
     tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
     menu=tree.find(attrs={'id' : 'daypart_nav'})
     categories=menu.findAll('a')
     for item in categories:
         catid = item['onclick'].replace("showDaypart('",'').replace("');",'')
         name = catid.title()
         common.addDirectory(name,catid,mode="Shows")
Esempio n. 53
0
def getInfo(item, params, src, xml=False, mobile=False):
    paramArr = __parseParams(params)
    paramPage = paramArr[0].replace('%s', src)

    if paramPage.startswith('@') and paramPage.endswith('@'):
        paramPage = item.getInfo(paramPage.strip('@'))

    paramRegex = paramArr[1].replace('%s', src)
    if paramRegex.startswith('@') and paramRegex.endswith('@'):
        paramRegex = item.getInfo(paramRegex.strip('@'))

    referer = ''
    form_data = ''
    variables = []
    if len(paramArr) > 2:
        referer = paramArr[2]
        referer = referer.replace('%s', src)
        if referer.startswith('@') and referer.endswith('@'):
            referer = item.getInfo(referer.strip('@'))
    if len(paramArr) > 3:
        variables = paramArr[3].strip("'").split('|')

    parsed_link = urlparse.urlsplit(referer)
    parsed_link = parsed_link._replace(
        netloc=parsed_link.netloc.encode('idna'),
        path=urllib.quote(parsed_link.path.encode('utf-8')))
    referer = parsed_link.geturl().encode('utf-8')

    try:
        parts = (paramPage.split('|', 1) + [None] * 2)[:2]
        paramPage, form_data = parts
        form_data = urlparse.parse_qsl(form_data)

    except:
        pass
    common.log('Get Info from: "' + paramPage + '" from "' + referer + '"')
    #common.log('JairoX_GETINFO1:' + paramRegex)
    data = common.getHTML(paramPage,
                          form_data,
                          referer,
                          xml,
                          mobile,
                          ignoreCache=False,
                          demystify=True)
    #common.log('JairoX_GETINFO2:' + data)
    #common.log('JairoX_GETINFO2:' + repr(data))
    return reg.parseText(data, paramRegex, variables)
Esempio n. 54
0
 def __init__( self ):
     xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
     data = common.getHTML(common.BASE_URL)
     tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
     menu=tree.find(attrs={'id' : 'videoContent'})
     categories=menu.findAll('div', attrs={'id' : True}, recursive=False)
     for item in categories:
         if item['id'] == common.args.url:
             shows = item.findAll(attrs={'id' : 'show_block_interior'})
             for show in shows:
                 name = show.find('img')['alt'].encode('utf-8')
                 thumbnail = common.BASE_URL + show.find('img')['src']
                 url = common.BASE + show.find('a')['href'].encode('utf-8')
                 common.addDirectory(name, url,'Videos',thumb=thumbnail)
             break
     xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
     xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))
Esempio n. 55
0
    def addShowsList( self ):

        print "\n\n adding shows \n\n"

        content=common.getHTML(common.args.url)
        
        showsSegment=re.search('<item name="FULL EPISODES">.+?</item>', content, re.DOTALL).group(0)
        # showsSegment=re.search('<item name="USA ORIGINALS">.+?</item>', content, re.DOTALL).group(0)

        # title, showURL
        shows=re.compile('name="(.+?)".+?url="(.+?)"', re.DOTALL).findall(showsSegment, re.DOTALL)

        for title, showURL in shows:
            if (title.title() in thumbs):
                thumbnail=thumbs[title.title()]
            else:
                thumbnail=''
            common.addDirectory(common.cleanNames(title).title(), common.USA_BASE_URL + showURL, 'TV_Episodes_usa', thumbnail)
Esempio n. 56
0
    def addShowsList(self):

        print "\n\n adding shows \n\n"

        content = common.getHTML(common.args.url)

        # title, thumb, id, fanart
        shows = re.compile(
            '<series>.+?<name>(.+?)</name>.+?<thumbnailUrl>(.+?)</thumbnailUrl>.+?<id>(\d+)</id>.+?<backgroundUrl>(.+?)</backgroundUrl>.+?</series>',
            re.DOTALL).findall(content, re.DOTALL)

        for title, thumb, id, fanart in shows:
            showURL = "http://video.scifi.com/player/feeds/?level=%s&type=placement&showall=1" % (
                id)
            common.addDirectory(common.cleanNames(title),
                                showURL,
                                'TV_Episodes_scifi',
                                thumb=common.SCIFI_BASE_URL + thumb,
                                fanart=common.SCIFI_BASE_URL + fanart)
Esempio n. 57
0
    def __findRedirect(self, page, referer='', demystify=False):
        data = common.getHTML(page, referer=referer, demystify=demystify)

        link = findVideoFrameLink(page, data)
        if link:
            return link
        else:
            link = findContentRefreshLink(data)
            if link:
                return link
            else:
                link = findEmbedPHPLink(data)
                if link:
                    return link

        if not demystify:
            return self.__findRedirect(page, referer, True)

        return page
Esempio n. 58
0
try:
    url = urllib.unquote_plus(params['url'])
except:
    pass

try:
    title = urllib.unquote_plus(params['title'])
except:
    pass

if mode == SECTION:
    DoSection(url)

elif mode == SERIES:
    html = common.getHTML(url)

    while ('Previous Entries' in html):
        DoSeries(html)
        url = re.compile(
            '<div class="alignleft"><a href="(.+?)".+?Previous Entries</a>'
        ).search(html).group(1)
        html = common.getHTML(url)

    DoSeries(html)
    xbmcplugin.addSortMethod(
        int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE)

elif mode == EPISODE:
    try:
        PlayVideo(url)