Exemplo n.º 1
0
def play(uri = common.args.url,referer='http://www.mtv.com'):
    mtvn = 'http://media.mtvnservices.com/'+uri 
    swfUrl = common.getRedirect(mtvn,referer=referer)
    configurl = urllib.unquote_plus(swfUrl.split('CONFIG_URL=')[1].split('&')[0]).strip()
    #configurl = configurl.split('/config.xml?')[0]+'/context4/config.xml?'+configurl.split('/config.xml?')[1]
    configxml = common.getURL(configurl,referer=mtvn)
    tree=BeautifulStoneSoup(configxml, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    feed = tree.find('feed')
    #try:
    mrssurl = feed.string.replace('{uri}',uri).replace('&','&')
    mrssxml = common.getURL(mrssurl)
    mrsstree = BeautifulStoneSoup(mrssxml, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    #except:
    #    mrsstree = feed
    segmenturls = mrsstree.findAll('media:content')
    stacked_url = 'stack://'
    for segment in segmenturls:
        surl = segment['url']#+'&acceptMethods=fms,hdn1,hds'
        videos = common.getURL(surl)
        videos = BeautifulStoneSoup(videos, convertEntities=BeautifulStoneSoup.HTML_ENTITIES).findAll('rendition')
        hbitrate = -1
        sbitrate = int(common.settings['quality'])
        for video in videos:
            bitrate = int(video['bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                rtmpdata = video.find('src').string
                rtmpurl = rtmpdata + " swfurl=" + swfUrl.split('?')[0] +" pageUrl=" + referer + " swfvfy=true"
        stacked_url += rtmpurl.replace(',',',,')+' , '
    stacked_url = stacked_url[:-3]
    item = xbmcgui.ListItem(path=stacked_url)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 2
0
def videos(url=common.args.url, xml_url=False):
    if not xml_url:
        data = common.getURL(url)
        xml_url = getShowXML_URL(data)
    data = common.getURL(xml_url)
    tree = BeautifulStoneSoup(data,
                              convertEntities=BeautifulStoneSoup.XML_ENTITIES)
    videos = tree.findAll('video')
    for video in videos:
        name = video.find('clipname').string
        showname = video.find('relatedtitle').string
        if not showname:
            showname = ''
        duration = video.find('length').string
        thumb = video.find('thumbnailurl').string.replace('_92x69', '_480x360')
        plot = video.find('abstract').string
        link = video.find('videourl').string
        playpath = link.replace('http://wms.scrippsnetworks.com',
                                '').replace('.wmv', '')
        url = 'rtmp://flash.scrippsnetworks.com:1935/ondemand?ovpfv=1.1 swfUrl="http://common.scrippsnetworks.com/common/snap/snap-3.0.3.swf" playpath=' + playpath
        infoLabels = {
            "Title": name,
            "Duration": duration,
            #"Season":season,
            #"Episode":episode,
            "Plot": plot,
            "TVShowTitle": showname
        }
        common.addVideo(url, name, thumb, infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 3
0
def playepisode(url=common.args.url):
    data = common.getURL(url)
    path = url.split('mylifetime.com/')[1].split('?')[0]
    jsonData = re.compile('Drupal\.settings\.video, (.+)\);').findall(data)[0]
    json = demjson.decode(jsonData)
    for item in json['cached_videos']:
        if item['path'] == path:
            smil_url = item['pdk_flash_url'].split('?')[0]
    #smil_url = json['cached_videos'][0]['pdk_flash_url'].split('?')[0]
    signed_url = sign_url(smil_url)
    link = common.getURL(signed_url)
    tree=BeautifulStoneSoup(link, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    base = tree.find('meta')['base']
    videos = tree.findAll('video')
    hbitrate = -1
    sbitrate = int(common.settings['quality']) * 1000
    for video in videos:
        try:bitrate = int(video['system-bitrate'])
        except:
            try:bitrate = int(video['systembitrate'])
            except: bitrate = 1
        if bitrate > hbitrate and bitrate <= sbitrate:
            hbitrate = bitrate
            filename = video['src'].replace('.mp4','').replace('.flv','')
    swfUrl = 'http://www.mylifetime.com/shows/sites/all/libraries/pdk_player/pdk/swf/flvPlayer.swf'
    auth = filename.split('?')[1]
    filename = filename.split('?')[0]
    finalurl = base+'?'+auth+' swfurl='+swfUrl+' swfvfy=true playpath='+filename
    item = xbmcgui.ListItem(path=finalurl)
    return xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 4
0
def playThePlatform():
    data = common.getURL(common.args.url)
    #mrss = urllib.unquote_plus(base64.b64decode(re.compile('{ mrss: "(.+?)",').findall(data)[0]))
    try:mrss = urllib.unquote_plus(base64.b64decode(re.compile('{ mrss: "(.+?)",').findall(data)[0]))
    except:mrss = urllib.unquote_plus(base64.b64decode(re.compile('"mrss=(.+?)&').findall(data)[0]))
    tree=BeautifulStoneSoup(mrss, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    for item in tree.findAll('item'):
        link = item.find('link').string
        if link == common.args.url:
            smil_url = item.find('media:text',text=re.compile('smilUrl=')).string.split('smilUrl=')[1]
    #smil_url = re.compile('<media:text>smilUrl=(.+?)</media:text>').findall(mrss)[0]
    #signUrl  = 'http://www.history.com/components/get-signed-signature'
    #signUrl += '?url='+smil_url.split('/s/')[1].split('?')[0]
    #signUrl += '&cache='+str(random.randint(100, 999))
    #sig = str(common.getURL(signUrl))
    sig = sign_url(smil_url)
    smil_url += '&sig='+sig
    data = common.getURL(smil_url)
    tree=BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    rtmp_base = tree.find('meta')['base']
    filenames = tree.findAll('video')
    hbitrate = -1
    sbitrate = int(common.settings['quality'])
    for filename in filenames:
        bitrate = int(filename['system-bitrate'])/1024
        if bitrate > hbitrate and bitrate <= sbitrate:
            hbitrate = bitrate
            playpath = filename['src']
    swfUrl = 'http://www.aetv.com/js/minisite4g/VideoPlayer.swf'
    rtmpurl = rtmp_base+' playpath='+playpath + " swfurl=" + swfUrl + " swfvfy=true"
    item = xbmcgui.ListItem(path=rtmpurl)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 5
0
def show_cats(url=common.args.url):
    data = common.getURL(url.replace(' ','%20'))
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    homedir = tree.find('div',attrs={'id':'video_home_dir','style':'display : none'}).string
    series_base  = 'http://www.aetv.com/minisite/videoajx.jsp'
    series_base += '?homedir='+homedir
    #full_series_url = series_url+'&pfilter=FULL%20EPISODES'
    #clips_series_url = series_url+'&pfilter=CLIPS'
    if homedir == '/lifestyle/' or homedir == '/classic/':
        series = url.split('=')[-1].replace(' ','%20')
        series_url = series_base + '&seriesfilter='+series
    else:
        series_url = series_base
    data = common.getURL(series_url)
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    seasons = tree.find('div',attrs={'id':'primary_filter'}).findAll('li',attrs={'class':None})
    if len(seasons) > 0:
        for season in seasons:
            link = season.find('a')
            if '?' in series_base:
                season_url = series_base + '&pfilter='+link.string.strip().replace(' ','%20')
            else:
                season_url = series_base + '?pfilter='+link.string.strip().replace(' ','%20')
            if homedir == '/lifestyle/' or homedir == '/classic/':
                series = url.split('=')[-1].replace(' ','%20')
                season_url += '&seriesfilter='+series
            common.addDirectory(link.string.title(), 'aetv', 'showseasonThePlatform', season_url)
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
        common.setView('seasons')
    else:
        showseasonThePlatform(url.replace(' ','%20'),tree=tree)
    common.setView('seasons')
Exemplo n.º 6
0
def playuri(uri=common.args.url, referer='http://nicktoons.nick.com'):
    mtvn = 'http://media.nick.com/' + uri
    swfUrl = common.getRedirect(mtvn, referer=referer)
    configurl = urllib.unquote_plus(
        swfUrl.split('CONFIG_URL=')[1].split('&')[0]).strip()
    configxml = common.getURL(configurl, referer=mtvn)
    tree = BeautifulStoneSoup(configxml,
                              convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    mrssurl = tree.find('feed').string.replace('{uri}', uri).replace(
        '&amp;', '&').replace('{type}',
                              'network').replace('mode=episode', 'mode=clip')
    mrssxml = common.getURL(mrssurl)
    tree = BeautifulStoneSoup(mrssxml,
                              convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    segmenturls = tree.findAll('media:content')
    stacked_url = 'stack://'
    for segment in segmenturls:
        surl = segment['url']
        videos = common.getURL(surl)
        videos = BeautifulStoneSoup(
            videos, convertEntities=BeautifulStoneSoup.HTML_ENTITIES).findAll(
                'rendition')
        hbitrate = -1
        sbitrate = int(common.settings['quality'])
        for video in videos:
            bitrate = int(video['bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                rtmpdata = video.find('src').string
                rtmpurl = rtmpdata + " swfurl=" + swfUrl.split(
                    '?')[0] + " pageUrl=" + referer + " swfvfy=true"
        stacked_url += rtmpurl.replace(',', ',,') + ' , '
    stacked_url = stacked_url[:-3]
    item = xbmcgui.ListItem(path=stacked_url)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 7
0
def rootlist(db=False):
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
    db_shows = []
    data = common.getURL(BASEURL)
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    showpages = tree.findAll(attrs={'class':'watch more'}) 
    for show in showpages:
        url = show['href']
        name = url.split('/')[2].replace('-',' ').title()
        url = BASE + url
        if db==True:
            db_shows.append((name,'history','showcats',url))
        else:
            common.addShow(name, 'history', 'showcats', url)
    data = common.getURL(H2URL)
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    showpages = tree.findAll(attrs={'class':'watch more'})
    for show in showpages:
        url = show['href']
        name = url.split('/')[2].replace('-',' ').title()
        url = BASE + url
        if db==True:
            db_shows.append((name,'history','showcats',url))
        else:
            common.addShow(name, 'history', 'showcats', url)
    if db==True:
        return db_shows    
    else:
        common.setView('tvshows')
Exemplo n.º 8
0
def play(url=common.args.url):
    finalurl=False
    playpath=False
    vid= re.compile('(VD\d*)').findall(url)[0]
    rtmpdata = 'http://cdn.abc.go.com/vp2/ws/s/contents/2002/utils/video/mov/17496/9024/%s/432?v=05040017_1' % vid
    data = common.getURL(rtmpdata)
    tree=BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    hosts = tree.findAll('host')
    for host in hosts:
        if 'Akamai' in host['name']:
            rtmp = 'rtmpe://%s/%s' % (host['url'], host['app'])
    filenames = tree.findAll('video')
    hbitrate = -1
    sbitrate = int(common.settings['quality'])
    for filename in filenames:
        if filename['src'] <> '':
            bitrate = int(filename['bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                playpath = filename['src']
    if playpath:
        swfUrl = 'http://ll.static.abc.com/m/vp2/prod/flash/VP2_05040017_0_1254.swf'
        finalurl = rtmp+' playpath='+playpath + " swfurl=" + swfUrl + " swfvfy=true"
    else:
        plid= re.compile('(PL\d*)').findall(url)[0]
        clipurl = 'http://abc.go.com/vp2/ws/s/contents/1000/videomrss?brand=002&device=001&start=0&limit=100&fk=CATEGORIES&fv='+plid
        data = common.getURL(clipurl)
        tree=BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
        for video in tree.findAll('item'):
            if video.find('guid').string == vid:
                finalurl = video.find('media:content')['url']
    if finalurl:
        item = xbmcgui.ListItem(path=finalurl)
        xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 9
0
def play(url=common.args.url):
    print "DEBUG Entering play function"
    swfUrl = 'http://can.cbs.com/thunder/player/chrome/canplayer.swf'
    if 'http://' in url:
        data = common.getURL(url)
        try:
            pid = re.compile('var pid = "(.*?)";').findall(data)[0]
        except:
            pid = re.compile("var pid = '(.*?)';").findall(data)[0]
    else:
        pid = url
    # OLD URL
    #url = "http://release.theplatform.com/content.select?format=SMIL&Tracking=true&balance=true&MBR=true&pid=" + pid
    url = "http://link.theplatform.com/s/dJ5BDC/%s?format=SMIL&Tracking=true&mbr=true" % pid
    if (common.settings['enableproxy'] == 'true'):
        proxy = True
    else:
        proxy = False
    data = common.getURL(url, proxy=proxy)
    tree = BeautifulStoneSoup(data,
                              convertEntities=BeautifulStoneSoup.XML_ENTITIES)

    if (common.settings['enablesubtitles'] == 'true'):
        closedcaption = tree.find('param', attrs={'name': 'ClosedCaptionURL'})
        if (closedcaption is not None):
            xml_closedcaption = common.getURL(closedcaption['value'])
            convert_subtitles(xml_closedcaption, pid)

    rtmpbase = tree.find('meta')
    if rtmpbase:
        rtmpbase = rtmpbase['base']
        items = tree.find('switch').findAll('video')
        hbitrate = -1
        sbitrate = int(common.settings['quality']) * 1024
        for item in items:
            bitrate = int(item['system-bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                playpath = item['src']
                if '.mp4' in playpath:
                    playpath = 'mp4:' + playpath
                else:
                    playpath = playpath.replace('.flv', '')
                finalurl = rtmpbase + ' playpath=' + playpath + " swfurl=" + swfUrl + " swfvfy=true"
    item = xbmcgui.ListItem(path=finalurl)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)
    if (common.settings['enablesubtitles'] == 'true') and (closedcaption
                                                           is not None):
        while not xbmc.Player().isPlaying():
            print 'CBS--> Not Playing'
            xbmc.sleep(100)

        subtitles = os.path.join(common.pluginpath, 'resources', 'cache',
                                 pid + '.srt')
        print "CBS --> Setting subtitles"
        xbmc.Player().setSubtitles(subtitles)
Exemplo n.º 10
0
def rootlist(db=False):
    shows = []
    multishow = {}

    # Grab Current Shows
    data = common.getURL('http://www.mtv.com/ontv/all/current.jhtml')
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    shows, multishow = grabShowlist(tree, shows, multishow)

    # Grab Current Shows MTV2
    data = common.getURL('http://www.mtv.com/ontv/all/currentMtv2.jhtml')
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    shows, multishow = grabShowlist(tree, shows, multishow)

    # Process Full Show List
    data = common.getURL(BASE_URL)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    shows, multishow = grabShowlist(tree, shows, multishow)
    pagintation = tree.find(attrs={'class': 'pagintation'}).findAll('a')
    for page in pagintation:
        if 'Next' in page.string:
            continue
        url = BASE_URL + page['href']
        data = common.getURL(url)
        tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
        shows, multishow = grabShowlist(tree, shows, multishow)

    # Grab Popular Shows
    popularShows = tree.find('div',
                             attrs={
                                 'id': 'shows-grid',
                                 'class': 'grid'
                             }).find('ul').findAll('a')
    for item in popularShows:
        name = item.string
        if 'All Shows' not in name:
            url = BASE + item['href']
            cleanname = name.split(' (Season')[0]
            if cleanname in multishow.keys():
                multishow[cleanname] = True
            else:
                multishow[cleanname] = False
                shows.append((cleanname, url))

    db_shows = []
    for name, url in shows:
        mode = 'showsub'
        db_shows.append((name, 'mtv', mode, url))
    if db == True:
        return db_shows
    else:
        for name, mode, submode, url in db_shows:
            common.addShow(name, mode, submode, url)
        common.setView('tvshows')
Exemplo n.º 11
0
def fullepisodes(url=common.args.url):
    data = common.getURL(url)
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    seasons=tree.find('ul',attrs={'class' : 'season_navigation'}).findAll('a')
    for season in seasons:
        data = common.getURL(season['href'])
        tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
        episodes=tree.find(attrs={'class' : 'clips'}).findAll('div',recursive=False)
        for episode in episodes:
            try: uri = episode.find('a')['href']
            except: continue
            name = episode.find('img')['title']
            thumb = episode.find('img')['src'].split('?')[0]
            description = episode.findAll('p')[0].contents[0].strip().encode('utf-8')
            airDate = episode.findAll('p')[1].contents[2].strip().encode('utf-8')
            try:
                seasonepisode = episode.find(attrs={'class' : 'title'}).contents[2].replace('- Episode ','').strip()
                if 3 == len(seasonepisode):
                    season = int(seasonepisode[:1])
                    episode = int(seasonepisode[-2:])
                elif 4 == len(seasonepisode):
                    season = int(seasonepisode[:2])
                    episode = int(seasonepisode[-2:])
            except:
                season=0
                episode=0
            if season <> 0 or episode <> 0:
                displayname = '%sx%s - %s' % (str(season),str(episode),name)
            else:
                displayname = name
            #except:
            #    print 'no season data'
            #    displayname = name
            #    season = 0
            #    episode = 0
            u = sys.argv[0]
            u += '?url="'+urllib.quote_plus(uri)+'"'
            u += '&mode="spike"'
            u += '&sitemode="playepisode"'
            infoLabels={ "Title":name,
                         "Season":season,
                         "Episode":episode,
                         "Plot":description,
                         "premiered":airDate
                         #"Duration":duration,
                         #"TVShowTitle":common.args.name
                         }
            common.addVideo(u,displayname,thumb,infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 12
0
def playuri(uri=common.args.url, referer='www.vh1.com'):
    mp4_url = "http://mtvnmobile.vo.llnwd.net/kip0/_pxn=0+_pxK=18639+_pxE=/44620/mtvnorigin"
    mtvn = 'http://media.mtvnservices.com/' + uri
    swfUrl = common.getRedirect(mtvn)  #,referer=referer)
    configurl = urllib.unquote_plus(
        swfUrl.split('CONFIG_URL=')[1].split('&')[0])
    configxml = common.getURL(configurl)
    tree = BeautifulStoneSoup(configxml,
                              convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    feed = tree.find('player').find('feed')
    try:
        mrssurl = feed.string.replace('{uri}',
                                      uri).replace('{ref}', 'None').replace(
                                          '&amp;', '&').strip()
        mrssxml = common.getURL(mrssurl)
        mrsstree = BeautifulStoneSoup(
            mrssxml, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    except:
        mrsstree = feed
    segmenturls = mrsstree.findAll('media:content')
    stacked_url = 'stack://'
    for segment in segmenturls:
        surl = segment['url']
        videos = common.getURL(surl)
        videos = BeautifulStoneSoup(
            videos, convertEntities=BeautifulStoneSoup.HTML_ENTITIES).findAll(
                'rendition')
        hbitrate = -1
        sbitrate = int(common.settings['quality'])
        for video in videos:
            bitrate = int(video['bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                rtmpdata = video.find('src').string
                rtmpurl = mp4_url + rtmpdata.split('viacomvh1strm')[2]
                #protocall = rtmpdata.split('://')[0]
                #host = rtmpdata.split('://')[1].split('/')[0]
                #app = rtmpdata.split('://')[1].split('/')[1]
                #playpath = rtmpdata.split(app+'/')[1]
                #if '.mp4' in playpath:
                #    playpath = 'mp4:'+playpath#.replace('.mp4','')
                #else:
                #    playpath = playpath#.replace('.flv','')
                #rtmpurl = 'rtmpe://'+host+':1935/'+app
                #rtmpurl += ' playpath=' + playpath + " swfurl=" + swfUrl.split('?')[0] +" pageUrl=" + referer + " swfvfy=true"
        stacked_url += rtmpurl.replace(',', ',,') + ' , '
    stacked_url = stacked_url[:-3]
    item = xbmcgui.ListItem(path=stacked_url)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 13
0
def GET_RTMP(vid):
    #url = 'http://www.tbs.com/video/cvp/videoData.jsp?oid='+vid
    url = 'http://www.tbs.com/tveverywhere/content/services/cvpXML.do?titleId=' + vid
    html = common.getURL(url)
    tree = BeautifulStoneSoup(html,
                              convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    #print tree.prettify()
    files = tree.findAll('file')
    if not files:
        url = 'http://www.tbs.com/tveverywhere/content/services/cvpXML.do?titleId=&id=' + vid
        html = common.getURL(url)
        tree = BeautifulStoneSoup(
            html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
        #print tree.prettify()
        files = tree.findAll('file')
    if files:
        html = common.getURL(url)
        tree = BeautifulStoneSoup(
            html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
        print tree.prettify()
        sbitrate = int(common.settings['quality'])
        hbitrate = -1
        files = tree.findAll('file')
        for filenames in files:
            try:
                bitrate = int(filenames['bitrate'])
            except:
                bitrate = 1
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                filename = filenames.string
        serverDetails = tree.find('akamai')
        if serverDetails:
            filename = filename[1:len(filename) - 4]
            serverDetails = tree.find('akamai')
            server = serverDetails.find('src').string.split('://')[1]
            #get auth
            tokentype = serverDetails.find('authtokentype').string
            window = serverDetails.find('window').string
            aifp = serverDetails.find('aifp').string
            auth = getAUTH(aifp, window, tokentype, vid,
                           filename.replace('mp4:', ''))
            swfUrl = 'http://www.tbs.com/cvp/tbs_video.swf'
            link = 'rtmpe://' + server + '?' + auth + " swfurl=" + swfUrl + " swfvfy=true" + ' playpath=' + filename
        elif 'http://' in filename:
            link = filename
        else:
            link = 'http://ht.cdn.turner.com/tbs/big' + filename
        return link
Exemplo n.º 14
0
def episodes(url=common.args.url):
    data = common.getURL(url)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    addVideos(tree)
    pagedata = re.compile('new Paginator\((.+?),(.+?)\)').findall(data)
    if pagedata:
        total = int(pagedata[0][0])
        current = int(pagedata[0][1])
        if total > 1:
            for page in range(1, total):
                data = common.getURL(url + '/' + str(page) + '/')
                tree = BeautifulSoup(
                    data, convertEntities=BeautifulSoup.HTML_ENTITIES)
                addVideos(tree)
    common.setView('episodes')
Exemplo n.º 15
0
def videos(url=common.args.url, tree=False):
    if not tree:
        data = common.getURL(url)
        tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    videos = tree.find('ol', attrs={'id': 'vid_mod_1'})
    if videos:
        videos = videos.findAll('li', attrs={'id': re.compile('vidlist')})
        for video in videos:
            thumb = BASE + video.find('img')['src']
            name = video['maintitle']
            url = BASE + video['mainurl']
            uri = video['mainuri']
            if uri == '':
                uri = url
            airDate = video['mainposted']
            description = video['maincontent']
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(uri) + '"'
            u += '&mode="mtv"'
            u += '&sitemode="play"'
            infoLabels = {
                "Title": name,
                #"Season":season,
                #"Episode":episode,
                "Plot": description,
                "premiered": airDate
                #"Duration":duration,
                #"TVShowTitle":common.args.name
            }
            common.addVideo(u, name, thumb, infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 16
0
def shows(cid = common.args.url,db=False):
        name = common.args.name
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
        if name == 'Full Episodes' or name == 'Web Exclusives':
            mode = 'episode' #EPISODE() Mode
        else:
            mode = 'show' #SHOW() Mode
        url = 'http://www.tnt.tv/content/services/getCollections.do?site=true&id=58127'
        html=common.getURL(BASE_URL)
        tree=BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
        collections = tree.findAll('collection')
        db_shows = []
        for collection in collections:
                if collection['id'] == cid:
                        subcollections = collection.findAll('subcollection')
                        for subcollection in subcollections:
                                scid = subcollection['id']
                                name = subcollection.find('name').string.split('-')[0].replace('Full Episodes','').strip()
                                if db==True:
                                        db_shows.append((name,'tnt',mode,scid))
                                else:
                                        common.addShow(name, 'tnt', mode, scid)
        if db==True:
                return db_shows
        else:
                common.setView('tvshows') 
Exemplo n.º 17
0
def PAGES(tree):
    try:
        print 'starting PAGES'
        try:
            search_elements = tree.find(attrs={'name': 'searchEl'})['value']
            return_elements = tree.find(attrs={'name': 'returnEl'})['value']
        except:
            print 'CBS: search and return elements failed'
        try:
            last_page = tree.find(attrs={
                'id': 'pagination0'
            }).findAll(attrs={'class': 'vids_pag_off'})[-1].string
            last_page = int(last_page) + 1
        except:
            print 'CBS: last page failed reverting to default'
            last_page = 2
        for pageNum in range(1, last_page):
            values = {
                'pg': str(pageNum),
                'repub': 'yes',
                'displayType': 'twoby',
                'search_elements': search_elements,
                'return_elements': return_elements,
                'carouselId': '0',
                'vs': 'Default',
                'play': 'true'
            }
            url = 'http://www.cbs.com/sitecommon/includes/video/2009_carousel_data_multiple.php'
            data = common.getURL(url, values)
            VIDEOLINKS(data)
    except:
        print 'Pages Failed'
Exemplo n.º 18
0
def masterlist():
    data = common.getURL(BASE_URL)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    menu = tree.find(attrs={'id': 'videoContent'})
    categories = menu.findAll('div', attrs={'id': True}, recursive=False)
    db_shows = []
    for item in categories:
        shows = item.findAll(attrs={'id': 'show_block_interior'})
        for show in shows:
            name = show.find('img')['alt'].encode('utf-8')
            thumb = BASE_URL + show.find('img')['src']
            url = BASE + show.find('a')['href']
            if 'MacGyver' in name:
                url += '?vs=Full%20Episodes'
            if 'daytime/lets_make_a_deal' in url:
                url = url.replace('daytime/lets_make_a_deal',
                                  'shows/lets_make_a_deal')
            elif 'cbs_evening_news/video/' in url:
                url = 'http://www.cbs.com/shows/cbs_evening_news/video/'
            elif 'shows/dogs_in_the_city/' in url:
                url += 'video/'
            elif '/shows/3/' in url:
                url += 'video/'
            elif '/shows/3/' in url:
                url += 'video/'
            elif '/shows/nyc_22' in url:
                name = 'NYC 22'
                url += 'video/'
            db_shows.append((name, 'cbs', 'showcats', url))
    for show in stShows('http://startrek.com/videos', db=True):
        db_shows.append(show)
    return db_shows
Exemplo n.º 19
0
def show(url=common.args.url):
    data = common.getURL(url)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    carousels = tree.findAll('div', attrs={'class': 'tab-wrap'})
    for carousel in carousels:
        videos = carousel.findAll('li',
                                  attrs={
                                      'id': True,
                                      'class': re.compile('result-item')
                                  })
        for video in videos:
            infoLabels = {}
            exp_id = video.find('a')['data-video']
            thumb = video.find('img')['src']
            infoLabels['Title'] = video.find('img')['title']
            infoLabels['Plot'] = video.find('p',
                                            attrs={
                                                'class': 'description'
                                            }).string.strip()
            infoLabels['TVShowTitle'] = common.args.name
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&exp_id="' + urllib.quote_plus(exp_id) + '"'
            u += '&mode="marvelkids"'
            u += '&sitemode="play"'
            common.addVideo(u,
                            infoLabels['Title'],
                            thumb,
                            infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 20
0
def episodes(url=common.args.url):
    data = common.getURL(url)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    menu = tree.findAll('div', attrs={'class': 'tile'})
    for item in menu:
        link = item.find('div', attrs={'class': 'tile_title'}).find('a')
        name = link.string
        url = link['href']
        thumb = item.find('img')['src']
        try:
            description = item.find('div', attrs={'class': 'tile_desc'}).string
        except:
            description = ''
        show_tile_sub = item.find('div', attrs={
            'class': 'show_tile_sub'
        }).string.split('|')
        airDate = show_tile_sub[1].replace(' Aired on ', '').strip()
        duration = show_tile_sub[0].strip()
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="abc"'
        u += '&sitemode="play"'
        infoLabels = {
            "Title": name,
            "Plot": description,
            "premiered": common.formatDate(airDate, '%m/%d/%y'),
            "Duration": duration,
        }
        common.addVideo(u, name, thumb, infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 21
0
def show(url=common.args.url):
    data = common.getURL(url)
    videos = demjson.decode(data.split(' = ')[1])[0]['videos']
    for video in videos:
        if 'Season' in common.args.name:
            season = int(common.args.name.split('Season')[1])
            showname = common.args.name.split('Season')[0]
        else:
            showname = common.args.name
            season = 0
        #episode = int(video['number'])
        name = video['label']
        duration = video['length']
        thumb = video['thumbnailURL']
        description = video['description']
        airDate = video['delvStartDt']
        playpath = video['videoURL'].replace('http://wms.scrippsnetworks.com',
                                             '').replace('.wmv', '')
        url = 'rtmp://flash.scrippsnetworks.com:1935/ondemand?ovpfv=1.1'
        url += ' swfUrl=http://common.scrippsnetworks.com/common/snap/snap-3.0.3.swf playpath=' + playpath
        displayname = name
        infoLabels = {
            "Title": name,
            "Season": season,
            #"Episode":episode,
            "Plot": description,
            "premiered": airDate,
            "Duration": duration,
            "TVShowTitle": showname
        }
        common.addVideo(url, displayname, thumb, infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 22
0
def play():
    smilurl = common.args.url
    swfUrl = 'http://www.bravotv.com/_tp/pdk/swf/flvPlayer.swf'
    if (common.settings['enableproxy'] == 'true'): proxy = True
    else: proxy = False
    data = common.getURL(smilurl, proxy=proxy)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    print tree.prettify()
    rtmpbase = tree.find('meta')
    if rtmpbase:
        rtmpbase = rtmpbase['base']
        items = tree.find('switch').findAll('video')
        hbitrate = -1
        sbitrate = int(common.settings['quality']) * 1024
        for item in items:
            bitrate = int(item['system-bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                playpath = item['src']
                if '.mp4' in playpath:
                    playpath = 'mp4:' + playpath
                else:
                    playpath = playpath.replace('.flv', '')
                finalurl = rtmpbase + ' playpath=' + playpath + " swfurl=" + swfUrl + " swfvfy=true"
    else:
        items = tree.find('switch').findAll('video')
        hbitrate = -1
        sbitrate = int(common.settings['quality']) * 1024
        for item in items:
            bitrate = int(item['system-bitrate'])
            if bitrate > hbitrate and bitrate <= sbitrate:
                hbitrate = bitrate
                finalurl = item['src']
    item = xbmcgui.ListItem(path=finalurl)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 23
0
def GET_RTMP(vid):
    url = 'http://www.adultswim.com/astv/mvpd/services/cvpXML.do?id=' + vid
    html = common.getURL(url)
    tree = BeautifulStoneSoup(html,
                              convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    print tree.prettify()
    sbitrate = int(common.settings['quality'])
    hbitrate = -1
    files = tree.findAll('file')
    for filenames in files:
        try:
            bitrate = int(filenames['bitrate'])
        except:
            bitrate = 1
        if bitrate > hbitrate and bitrate <= sbitrate:
            hbitrate = bitrate
            filename = filenames.string
    if 'http://' in filename:
        filename = filename
        return filename
    else:
        filename = filename[1:len(filename) - 4]
        serverDetails = tree.find('akamai')
        server = serverDetails.find('src').string.split('://')[1]
        #get auth
        tokentype = serverDetails.find('authtokentype').string
        window = serverDetails.find('window').string
        aifp = serverDetails.find('aifp').string
        auth = getAUTH(aifp, window, tokentype, vid,
                       filename.replace('mp4:', ''))
        #swfUrl = 'http://www.tbs.com/cvp/tbs_video.swf swfvfy=true'
        rtmp = 'rtmpe://' + server + '?' + auth + ' playpath=' + filename  #+" swfurl="+swfUrl
        return rtmp
Exemplo n.º 24
0
def videosRSS(url=common.args.url):
    link = common.getURL(url)
    mrssData = re.compile('mrssData += +"(.+)"').findall(link)[0];
    mrssData = urllib2.unquote(base64.decodestring(mrssData))
    tree=BeautifulStoneSoup(mrssData,convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    print tree.prettify()
    items = tree.findAll('item')
    for item in items:
        title = item.title.contents[0]
        plot  = item.description.contents[0]
        thumb = item.findAll('media:thumbnail')[0]['url']
        duration = item.findAll('media:content')[0]['duration']
        smil = item.findAll('media:text')[5].contents[0]
        smil = smil.replace('smilUrl=','')
        #episode_list.append((title, image, duration, plot, smil))
        u = sys.argv[0]
        u += '?url="'+urllib.quote_plus(smil)+'"'
        u += '&mode="history"'
        u += '&sitemode="play"'
        infoLabels={ "Title":title,
                     #"Season":season,
                     #"Episode":episode,
                     "Plot":plot,
                     #"premiered":airdate,
                     "Duration":duration,
                     #"TVShowTitle":common.args.name
                     }
        common.addVideo(u,title,thumb,infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 25
0
def play(url=common.args.url):
    swfUrl = 'http://admin.brightcove.com/viewer/us20120228.1146/federatedVideoUI/BrightcovePlayer.swf'

    data = common.getURL(url)
    exp_id, key = re.compile(
        'BrightcoveHTML5PlayerChange\.init\(".+?", "(.+?)", "(.+?)"\);'
    ).findall(data)[0]
    content_id = re.compile('videoPlayer" value="(.+?)"').findall(data)[0]

    renditions = get_episode_info(
        key, content_id, url,
        exp_id)['programmedContent']['videoPlayer']['mediaDTO']['renditions']
    print renditions
    rtmp = ''
    hi_res = 0
    selected_video = None
    for video in renditions:
        if (int(video['size']) > hi_res):
            selected_video = video
            hi_res = int(video['size'])

    rtmpdata = selected_video['defaultURL'].split('&mp4:')
    rtmp = rtmpdata[0] + ' playpath=mp4:' + rtmpdata[1]
    rtmp += ' pageUrl=' + url

    item = xbmcgui.ListItem(path=rtmp)
    return xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 26
0
def play(url=common.args.url):
    swfUrl = 'http://admin.brightcove.com/viewer/us20110809.1526/federatedVideoUI/BrightcovePlayer.swf'
    exp_id = common.args.exp_id
    data = common.getURL(url)

    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    key = tree.find('param', attrs={'name': 'playerKey'})['value']
    content_id = tree.find('param', attrs={'name': '@videoPlayer'})['value']

    #key = re.compile('<param name="playerKey" value="(.+?)" />').findall(data)[0]
    #content_id = re.compile('<param name="@videoPlayer" value="(.+?)" />').findall(data)[0]
    #exp_id = re.compile('<param name="playerID" value="(.+?)" />').findall(data)[0]

    renditions = get_episode_info(
        key, content_id, url,
        exp_id)['programmedContent']['videoPlayer']['mediaDTO']['renditions']
    rtmp = ''
    hi_res = 0
    selected_video = None
    for video in renditions:
        if (int(video['size']) > hi_res):
            selected_video = video
            hi_res = int(video['size'])

    link = selected_video['defaultURL']
    item = xbmcgui.ListItem(path=link)
    return xbmcplugin.setResolvedUrl(pluginhandle, True, item)
Exemplo n.º 27
0
def full_bios(path=common.args.url):
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
    for page in range(1, 4):
        url = BASE + path + '?page-number=' + str(
            page
        ) + '&pagination-sort-by=alphabetical&pagination-per-page=100&prev-sort=alphabetical&prev-per-page=100'
        data = common.getURL(url)
        tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
        videos = tree.find('div', attrs={
            'class': 'video-results clearfix'
        }).findAll('li')
        for video in videos:
            link = video.find('a')
            name = link.find('strong').string.strip()
            type = name.split(' - ')[1].strip()
            name = name.split(' - ')[0]
            if type == 'Full Episode' or type == 'Full Biography':
                pass
            else:
                name += ' (' + type + ')'
            url = BASE + link['href']
            #thumb = video.find('img')['src']
            thumb = ''
            duration = video.find('span', attrs={
                'class': 'video-duration'
            }).string.strip().replace('(', '').replace(')', '')
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="bio"'
            u += '&sitemode="play"'
            infoLabels = {"Title": name, "Duration": duration}
            common.addVideo(u, name, thumb, infoLabels=infoLabels)
    common.setView('episodes')
Exemplo n.º 28
0
def showcats():
    data = common.getURL(BASE_URL)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    video_types = tree.find('select',
                            attrs={
                                'id': 'rb-video-browser-content_type'
                            }).findAll('option')
    shows = tree.find('select', attrs={
        'id': 'rb-video-browser-show'
    }).findAll('option')  #,attrs={'title':True})
    db_shows = []
    for show in shows:
        if show['value'] == common.args.url:
            cats = show['title'].replace('[',
                                         '').replace(']',
                                                     '').replace('"',
                                                                 '').split(',')
            for type in video_types:
                if type['value'] in cats:
                    name = type.string
                    url = 'rb-video-browser-num_items=100'
                    url += '&module_id_base=rb-video-browser'
                    url += '&rb-video-browser-show=' + show['value']
                    url += '&rb-video-browser-content_type=' + type['value']
                    common.addDirectory(name, 'amc', 'videos', url)
    common.setView('seasons')
Exemplo n.º 29
0
def seasonsRSS(url=common.args.url):
    data = common.getURL(url)
    tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    video_rss = menu = tree.find(attrs={'type': 'application/rss+xml'})['href']
    showid = url.split('?')[0].split('/')[-1]
    url = 'http://abc.go.com/vp2/s/carousel?service=seasons&parser=VP2_Data_Parser_Seasons&showid=' + showid + '&view=season&bust=07000001_3'
    data = common.getURL(url)
    tree = BeautifulStoneSoup(data,
                              convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
    seasons = tree.findAll('a')
    for season in seasons:
        seasonid = season['seasonid']
        name = season.string.strip()
        url = video_rss.replace('-1/-1/-1', seasonid + '/-1/-1')
        common.addDirectory(name, 'abc', 'episodes', url)
    common.setView('seasons')
Exemplo n.º 30
0
def videos():
    url = 'http://www.amctv.com/index.php'
    values = {
        'video_browser_action': 'filter',
        'params[type]': 'all',
        'params[filter]': common.args.url,
        'params[page]': '1',
        'params[post_id]': '71306',
        'module_id_base': 'rb-video-browser'
    }
    data = common.getURL(url, values)
    data = demjson.decode(data)['html']['date']
    items = BeautifulSoup(
        data, convertEntities=BeautifulSoup.HTML_ENTITIES).findAll('li')
    for item in items:
        link = item.find('a')
        img = link.find('img')
        url = link['href']
        name = img['title']
        plot = img['alt'].replace('/n', ' ')
        thumb = img['src']
        print item.prettify()
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="amc"'
        u += '&sitemode="play"'
        infoLabels = {
            "Title": name,
            #"Season":season,
            #"Episode":episode,
            "Plot": plot,
            #"TVShowTitle":common.args.name
        }
        common.addVideo(u, name, thumb, infoLabels=infoLabels)
    common.setView('episodes')