def sp_seasons(url=common.args.url): for sn in range(1,17): sn = str(sn) name = 'Season '+sn url = sn common.addDirectory(name,'comedy','sp_episodes',url) common.setView('seasons')
def showsubcats(url=common.args.url): #Add season options data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) subs=tree.find(attrs={'class':'group-a'}).findAll('a') for sub in subs: name = sub.string url = sub['href'] if BASE not in url: url = BASE + url if name == None: name = sub.contents[-1] if 'Episodes' in name or 'Clips' in name or 'Peeks' in name or 'Watch' in name or 'Video' in name: if 'id=' in url: u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="vh1"' u += '&sitemode="playurl"' item=xbmcgui.ListItem(name) item.setInfo( type="Video", infoLabels={ "Title":name }) item.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(pluginhandle,url=u,listitem=item,isFolder=False) else: common.addDirectory(name,'vh1','videos',url) common.setView('seasons')
def show(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) sections=tree.find('ul',attrs={'class':'channel-list'}) if sections: sections = sections.findAll('li',recursive=False) for section in sections: name = section.find('h4').contents[1].strip() if common.args.name in name and common.args.name <> name: name = name.replace(common.args.name,'').strip().strip('-').strip(',').strip() url = section.find('a')['href'] if 'http://' not in url: url = BASE+url common.addDirectory(name, 'hgtv', 'videos', url) common.setView('seasons') else: xml_url=getShowXML_URL(data) if xml_url: videos(xml_url=xml_url) else: backup_url = tree.find('ul', attrs={'class' : "button-nav"}) if backup_url: if len(backup_url) > 2: show(backup_url.findAll('a')[1]['href']) else: backup2_url = tree.find('li', attrs={'class' : "tab-past-season"}) if backup2_url: show(backup2_url.a['href'])
def shows(url=common.args.url,db=False): data = common.getURL(showlist) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu = tree.find('div',attrs={'id':'accordion','class':'view-content'}).findAll('h3') names = [] for item in menu: name = item.find('a',attrs={'href':'#'}).string names.append(name) if db == False: marker = names.index(url) elif db == True: marker = names.index('Current Shows') menu = tree.find('div',attrs={'id':'accordion','class':'view-content'}) shows = menu.findAll('div',recursive=False)[marker].findAll('li') dbshows = [] for show in shows: showdata = show.findAll(attrs={'class':'field-content'}) name = showdata[0].a.string showid = showdata[1].string if db == False: if 'Movies' in common.args.name: common.addDirectory(name, 'lifetime', 'showroot', showid) else: common.addShow(name, 'lifetime', 'showroot', showid) elif db == True: dbshows.append((name, 'lifetime', 'showroot', showid)) if db == True: return dbshows else: common.setView('tvshows')
def listCatType(url,db,showtype=True): data = common.getURL(url) db_shows=[] if data: items = demjson.decode(data)['Entries'] for item in items: show_id=str(item['ID']) name=item['Name'] if db==True: db_shows.append((name, 'crackle', 'showroot', show_id)) else: if showtype: common.addShow(name, 'crackle', 'showroot', show_id) else: plot=item['Description'] genre=item['Genre'] thumb=item['ChannelArtTileLarge'] fanart=item['ChannelArtLandscape'] common.addDirectory(name, 'crackle', 'showroot', show_id, thumb, '', plot, '',genre) if db==True: return db_shows elif showtype: common.setView('tvshows') else: common.setView('seasons')
def show(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) sections = tree.find('ul', attrs={'class': 'channel-list'}) if sections: sections = sections.findAll('li', recursive=False) for section in sections: name = section.find('h4').contents[1].strip() if common.args.name in name and common.args.name <> name: name = name.replace(common.args.name, '').strip().strip('-').strip(',').strip() url = section.find('a')['href'] if 'http://' not in url: url = BASE + url common.addDirectory(name, 'hgtv', 'videos', url) common.setView('seasons') else: xml_url = getShowXML_URL(data) if xml_url: videos(xml_url=xml_url) else: backup_url = tree.find('ul', attrs={'class': "button-nav"}) if backup_url: if len(backup_url) > 2: show(backup_url.findAll('a')[1]['href']) else: backup2_url = tree.find('li', attrs={'class': "tab-past-season"}) if backup2_url: show(backup2_url.a['href'])
def listCatType(url, db, showtype=True): data = common.getURL(url) db_shows = [] if data: items = demjson.decode(data)['Entries'] for item in items: show_id = str(item['ID']) name = item['Name'] if db == True: db_shows.append((name, 'crackle', 'showroot', show_id)) else: if showtype: common.addShow(name, 'crackle', 'showroot', show_id) else: plot = item['Description'] genre = item['Genre'] thumb = item['ChannelArtTileLarge'] fanart = item['ChannelArtLandscape'] common.addDirectory(name, 'crackle', 'showroot', show_id, thumb, '', plot, '', genre) if db == True: return db_shows elif showtype: common.setView('tvshows') else: common.setView('seasons')
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')
def sp_seasons(url=common.args.url): for sn in range(1, 17): sn = str(sn) name = 'Season ' + sn url = sn common.addDirectory(name, 'comedy', 'sp_episodes', url) common.setView('seasons')
def seasonOptions(url=common.args.url): common.addDirectory('All Videos','vh1','videos',url) common.addDirectory('Full Episodes','vh1','videos',url+'fulleps') common.addDirectory('Bonus Clips','vh1','videos',url+'bonusclips') common.addDirectory('After Shows','vh1','videos',url+'aftershows') common.addDirectory('Sneak Peeks','vh1','videos',url+'sneakpeeks') common.setView('seasons')
def showsubcats(url=common.args.url): #Add season options data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) subs = tree.find(attrs={'class': 'group-a'}).findAll('a') for sub in subs: name = sub.string url = sub['href'] if BASE not in url: url = BASE + url if name == None: name = sub.contents[-1] if 'Episodes' in name or 'Clips' in name or 'Peeks' in name or 'Watch' in name or 'Video' in name: if 'id=' in url: u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="vh1"' u += '&sitemode="playurl"' item = xbmcgui.ListItem(name) item.setInfo(type="Video", infoLabels={"Title": name}) item.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(pluginhandle, url=u, listitem=item, isFolder=False) else: common.addDirectory(name, 'vh1', 'videos', url) common.setView('seasons')
def seasonOptions(url=common.args.url): common.addDirectory('All Videos', 'vh1', 'videos', url) common.addDirectory('Full Episodes', 'vh1', 'videos', url + 'fulleps') common.addDirectory('Bonus Clips', 'vh1', 'videos', url + 'bonusclips') common.addDirectory('After Shows', 'vh1', 'videos', url + 'aftershows') common.addDirectory('Sneak Peeks', 'vh1', 'videos', url + 'sneakpeeks') common.setView('seasons')
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')
def showcats(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) cats=tree.findAll(attrs={'class' : re.compile('(.+?)videoCollectionModule(.+?)')}) for cat in cats: name = cat.find('div',attrs={'class' : 'twocolumnheader'}).find('h3').string.title() common.addDirectory(name, 'abcfamily', 'videos', url) common.setView('seasons')
def show(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu = tree.find('div', attrs={'id': 'videotabs'}).findAll('li') for item in menu: itemurl = url + '<videotab>' + item['id'].replace('videotab_', '') name = item.find('p').string.split('(')[0].title() common.addDirectory(name, 'thecw', 'episodes', itemurl) common.setView('seasons')
def show(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.find('div',attrs={'id':'videotabs'}).findAll('li') for item in menu: itemurl = url +'<videotab>'+ item['id'].replace('videotab_','') name = item.find('p').string.split('(')[0].title() common.addDirectory(name, 'thecw', 'episodes', itemurl) common.setView('seasons')
def rootlist(): data = common.getURL(showlist) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu = tree.find('div',attrs={'id':'accordion','class':'view-content'}).findAll('h3') for item in menu: name = item.find('a',attrs={'href':'#'}).string common.addDirectory(name, 'lifetime', 'shows', name ) common.addDirectory('Full Movies', 'lifetime', 'movies', '') common.setView('seasons')
def rootlist(): data = common.getURL(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, 'cbs', 'shows', catid) common.setView('seasons')
def seasons(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) seasonmenu = tree.find('select', attrs={'id': 'videolist_id'}) if seasonmenu: seasons = seasonmenu.findAll('option') for season in seasons: url = BASE + season['value'] name = season.string common.addDirectory(name, 'vh1', 'seasonOptions', url) common.setView('seasons')
def stshowcats(url = common.args.url): stbase = 'http://www.startrek.com' data = common.getURL(url) remove = re.compile('<!.*?">') data = re.sub(remove, '', data) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) stcats=tree.find('div',attrs={'id' : 'content'}).findAll('div', attrs={'class' : 'box_news'}) for cat in stcats: name = cat.find('h4').contents[1].strip() common.addDirectory(name, 'cbs', 'stvideos', url+'<name>'+name) common.setView('seasons')
def show(): data = common.getURL(common.args.url) full = re.compile('f:"(.*?)",').findall(data) clip = re.compile('c:"(.*?)",').findall(data) if len(full) > 0: if full[0] <> '': common.addDirectory('Full Episodes', 'gsn', 'episodes', full[0]) if len(clip) > 0: if clip[0] <> '': common.addDirectory('Clips', 'gsn', 'episodes', clip[0]) common.setView('seasons')
def seasons(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) seasonmenu=tree.find('select',attrs={'id':'videolist_id'}) if seasonmenu: seasons = seasonmenu.findAll('option') for season in seasons: url = BASE + season['value'] name = season.string common.addDirectory(name,'vh1','seasonOptions',url) common.setView('seasons')
def rootlist(): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE) data = common.getURL(CONFIGURATION_URL) tree=BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.XML_ENTITIES) categories = tree.find('logiccategories').findAll('category') for category in categories: name = category['name'] description = category['description'] categoryid = category['categoryid'] common.addDirectory(name, 'adultswim', 'showbycat', categoryid) common.setView('seasons')
def rootlist(): print "DEBUG Entering rootlist function" data = common.getURL(BASE_URL) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.find(attrs={'id' : 'daypart_nav'}) categories=menu.findAll('a') for item in categories: if item['href'].find('javascript') == 0: catid = item['onclick'].replace("showDaypart('",'').replace("');",'') name = re.compile('<a.*>(.+)</a>').findall(str(item))[0].title() common.addDirectory(name, 'cbs', 'shows', catid) common.setView('seasons')
def rootlist(): # No mode - Root Listing url = getCollections + '?id=185669' html=common.getURL(url) tree=BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) collections = tree.findAll('collection') for collection in collections: cid = collection['id'] name = collection.find('name').string if name == 'feature - not show in nav': continue common.addDirectory(name.title(), 'tbs', 'shows', cid) common.setView('seasons')
def rootlist(): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE) data = common.getURL(CONFIGURATION_URL) tree = BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.XML_ENTITIES) categories = tree.find('logiccategories').findAll('category') for category in categories: name = category['name'] description = category['description'] categoryid = category['categoryid'] common.addDirectory(name, 'adultswim', 'showbycat', categoryid) common.setView('seasons')
def rootlist(): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) 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') for collection in collections: cid = collection['id'] name = collection.find('name').string if name == 'Featured': continue common.addDirectory(name, 'tnt', 'shows', cid) common.setView('seasons')
def rootlist(): # No mode - Root Listing url = getCollections + '?id=185669' html = common.getURL(url) tree = BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) collections = tree.findAll('collection') for collection in collections: cid = collection['id'] name = collection.find('name').string if name == 'feature - not show in nav': continue common.addDirectory(name.title(), 'tbs', 'shows', cid) common.setView('seasons')
def showcats(url = common.args.url): data = common.getURL(url) #try: # var show = new CBS.Show({id:111381}); # show_id = re.compile("new CBS\.Show\(id:(.*?)\);").findall(data) # url = 'http://www.cbs.com/carousels/'+dir3+'/video/'+dir1+'/'+dir2+'/0/400/ try: print 'CBS: Trying New Carousel' carousels = re.compile("loadUpCarousel\('(.*?)','(.*?)', '(.*?)', (.*?), true, stored").findall(data) carousels[0][0] for name,dir1,dir2,dir3 in carousels: url = 'http://www.cbs.com/carousels/'+dir3+'/video/'+dir1+'/'+dir2+'/0/400/' common.addDirectory(name, 'cbs', 'newvideos', url) except: print 'CBS: Carousel Failed' tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) try: print 'CBS: trying secondary-show-nav-wrapper' options = tree.find(attrs={'id' : 'secondary-show-nav-wrapper'}) options = options.findAll('a') for option in options: name = option.string.encode('utf-8') url = BASE + option['href'] common.addDirectory(name, 'cbs', 'videos', url) print 'CBS: trying vid_module' options = tree.findAll(attrs={'class' : 'vid_module'}) for option in options: moduleid = option['id'] name = option.find(attrs={'class' : 'hdr'}).string common.addDirectory(name, 'cbs', 'showsubcats', url+'<moduleid>'+moduleid) except: print 'CBS: secondary-show-nav-wrapper failed' print 'CBS: trying vid_module secondary' try: options = tree.findAll(attrs={'class' : 'vid_module'}) print 'DEBUG: '+options for option in options: moduleid = option['id'] name = option.find(attrs={'class' : 'hdr'}).string common.addDirectory(name, 'cbs', 'showsubcats', url+'<moduleid>'+moduleid) except: print 'CBS: vid_module secondary failed' print 'CBS: trying 16.04.2013 id-carousel' categories = re.compile("id-carousel-(\d+)").findall(str(tree)) for catid in categories: thisUrl = 'http://www.cbs.com/carousels/videosBySection/'+catid+'/offset/0/limit/40/xs/{excludeShow}' data = common.getURL(thisUrl) name = demjson.decode(data)['result']['title'] common.addDirectory(name, 'cbs', 'newvideos2', thisUrl) common.setView('seasons')
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')
def seasonOptions(url=common.args.url): #options=[] #vidmenu=tree.findAll('li',attrs={'class':re.compile('itemList-subItem')}) #for item in menu: # link = item.find('a') # name = link.contents[2] # url = BASE + link['href'] # if '?' in url: # parameters = '?'+url.split('?')[1] # options.append((name,parameters)) common.addDirectory('All Videos','mtv','videos',url) common.addDirectory('Full Episodes','mtv','videos',url+'fulleps') common.addDirectory('Bonus Clips','mtv','videos',url+'bonusclips') common.addDirectory('After Shows','mtv','videos',url+'aftershows') common.addDirectory('Sneak Peeks','mtv','videos',url+'sneakpeeks') common.setView('seasons')
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')
def showcats(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) colume1 = tree.find(attrs={'class':'col col-1'}) try: cats = colume1.find(attrs={'class':'parent videos'}).findAll(attrs={'class':'clearfix'}) for cat in cats: link = cat.find('a') url = link['href'] if BASE not in url: url = BASE + url name = link.string common.addDirectory(name, 'history', 'videos', url) common.setView('seasons') except: videos()
def seasonOptions(url=common.args.url): #options=[] #vidmenu=tree.findAll('li',attrs={'class':re.compile('itemList-subItem')}) #for item in menu: # link = item.find('a') # name = link.contents[2] # url = BASE + link['href'] # if '?' in url: # parameters = '?'+url.split('?')[1] # options.append((name,parameters)) common.addDirectory('All Videos', 'mtv', 'videos', url) common.addDirectory('Full Episodes', 'mtv', 'videos', url + 'fulleps') common.addDirectory('Bonus Clips', 'mtv', 'videos', url + 'bonusclips') common.addDirectory('After Shows', 'mtv', 'videos', url + 'aftershows') common.addDirectory('Sneak Peeks', 'mtv', 'videos', url + 'sneakpeeks') common.setView('seasons')
def show(cid = common.args.url): xbmcplugin.setContent(pluginhandle, 'shows') xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE) url = getCollections + '?id=' + cid html=common.getURL(url) if '<collections total_collections="0">' in html: episode(cid=cid) return tree=BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) collections = tree.findAll('collection') for collection in collections: cid = collection['id'] name = collection.find('name').string mode = episode common.addDirectory(name, 'tbs', 'episode', cid) common.setView('seasons')
def showseasonThePlatform(url=common.args.url,tree=False): if not tree: data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) seasons = tree.find('div',attrs={'id':'secondary_filter'}).findAll('li') if len(seasons) > 1: for season in seasons: link = season.find('a') if link.string == 'All Categories': season_url = url else: season_url = url+'&sfilter='+link.string.strip().replace(' ','%20') common.addDirectory(link.string, 'aetv', 'showsubThePlatform', season_url) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) common.setView('seasons') else: showsubThePlatform(url.replace(' ','%20'),tree=tree)
def show_primary_filter(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) primary_filter = tree.find('div',attrs={'id':'primary_filter'}) if primary_filter: filters = primary_filter.findAll('li',attrs={'class':None}) if len(filters) > 1: for filter in filters: link = filter.find('a') item_url = url + '&pfilter='+link.string.strip().replace(' ','%20') common.addDirectory(link.string.title(), 'aetv', 'show_secondary_filter', item_url) else: showsubThePlatform(url.replace(' ','%20'),tree=tree) else: showsubThePlatform(url.replace(' ','%20'),tree=tree) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) common.setView('seasons')
def videos(url = common.args.url): xbmcplugin.setContent(int(sys.argv[1]), 'episodes') data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) print 'CBS: trying vid_module' try: options = tree.findAll(attrs={'class' : 'vid_module'}) if len(options) == 1: PAGES(tree) else: for option in options: moduleid = option['id'] name = option.find(attrs={'class' : 'hdr'}).string common.addDirectory(name, 'cbs', 'showsubcats', url+'<moduleid>'+moduleid) except: PAGES(tree) common.setView('episodes')
def rootlist(db=False): #div id="showContainer_SH55170916" class="showContainer" data = common.getURL(showlist) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) shows=tree.findAll('div',attrs={'class':'showContainer'}) db_shows = [] for show in shows: name = show.find('a')['title'] url = show.find('a')['page'] if db==True: db_shows.append((name,'disneyxd','seasons',url)) else: common.addDirectory(name, 'disneyxd', 'seasons', url ) if db==True: return db_shows else: common.setView('tvshows')
def show(): scid = common.args.url xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE) 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') for collection in collections: subcollections = collection.findAll('subcollection') for subcollection in subcollections: if subcollection['id'] == scid: subsubcollections = subcollection.findAll('subsubcollection') for subsubcollection in subsubcollections: sscid = subsubcollection['id'] name = subsubcollection.find('name').string common.addDirectory(name, 'tnt', 'episode', sscid) common.setView('seasons')
def show(cid=common.args.url): xbmcplugin.setContent(pluginhandle, 'shows') xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE) url = getCollections + '?id=' + cid html = common.getURL(url) if '<collections total_collections="0">' in html: episode(cid=cid) return tree = BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) collections = tree.findAll('collection') for collection in collections: cid = collection['id'] name = collection.find('name').string mode = episode common.addDirectory(name, 'tbs', 'episode', cid) common.setView('seasons')
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')
def showroot(url = common.args.url): xbmcplugin.setContent(int(sys.argv[1]), 'shows') data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) sets=tree.find('div',attrs={'id' : 'scet-categories'}).findAll('div',attrs={'class' : 'scet-cat-group'}) for set in sets: set_title = set.find('h5').string.lower() if set_title == 'all videos': continue elif set_title == 'full episodes' or set_title == 'webisodes': mode = 'showsubFullEpisode' else: mode = 'showsubClips' for link in set.findAll('a'): name = link.string.strip() url = BASE+link['href'].split('?')[0]+'?view=detail' common.addDirectory(name, 'nbc', mode, url) common.setView('seasons')
def rootlist(db=False): data = common.getURL(BASE_URL) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) items = tree.find('ul', attrs={ 'class': 'left-col-menu video-landing clearfix' }).findAll('li', attrs={'class': True}) db_shows = [] common.addShow('Full Biographies', 'bio', 'full_bios', '/videos/full-bios') for item in items: if item['class'] == 'mainItem expanded' or item['class'] == 'mainItem ': if item.find('span').string == 'Shows': sub = item.find('ul') if sub <> None: subcats = sub.findAll('li') for cat in subcats: link = cat.find('a') name = link.find('span').string url = link['href'] if db == True: db_shows.append((name, 'bio', 'videos', url)) else: common.addShow(name, 'bio', 'videos', url) else: link = item.find('a') name = link.find('span').string url = link['href'] common.addDirectory(name, 'bio', 'videos', url) sub = item.find('ul') if sub <> None: subcats = sub.findAll('li') for cat in subcats: link = cat.find('a') name = link.find('span').string url = link['href'] if db == True: pass #db_shows.append((name, 'bio', 'videos', url)) else: common.addDirectory(name, 'bio', 'videos', url) if db == True: return db_shows else: common.setView('tvshows')
def showroot(url=common.args.url): xbmcplugin.setContent(int(sys.argv[1]), 'shows') data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) sets = tree.find('div', attrs={ 'id': 'scet-categories' }).findAll('div', attrs={'class': 'scet-cat-group'}) for set in sets: set_title = set.find('h5').string.lower() if set_title == 'all videos': continue elif set_title == 'full episodes' or set_title == 'webisodes': mode = 'showsubFullEpisode' else: mode = 'showsubClips' for link in set.findAll('a'): name = link.string.strip() url = BASE + link['href'].split('?')[0] + '?view=detail' common.addDirectory(name, 'nbc', mode, url) common.setView('seasons')
def showsub(): showname=common.args.name if 'series.jhtml' in common.args.url: videos_url = common.args.url.replace('series.jhtml','video.jhtml') elif common.args.url.endswith('/'): redirect_url = common.args.url+'video.jhtml' videos_url = common.getRedirect(redirect_url).replace('series.jhtml','video.jhtml') else: videos_url = common.args.url data = common.getURL(videos_url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) seasonmenu=tree.find('select',attrs={'id':'videolist_id'}) if seasonmenu: seasons = seasonmenu.findAll('option') for season in seasons: url = BASE + season['value'] name = season.string common.addDirectory(name,'mtv','seasonOptions',url) common.setView('seasons') else: seasonOptions(videos_url+'?filter=')
def showcats(url=common.args.url): data = common.getURL(url) #try: # var show = new CBS.Show({id:111381}); # show_id = re.compile("new CBS\.Show\(id:(.*?)\);").findall(data) # url = 'http://www.cbs.com/carousels/'+dir3+'/video/'+dir1+'/'+dir2+'/0/400/ try: print 'CBS: Trying New Carousel' carousels = re.compile( "loadUpCarousel\('(.*?)','(.*?)', '(.*?)', (.*?), true, stored" ).findall(data) carousels[0][0] for name, dir1, dir2, dir3 in carousels: url = 'http://www.cbs.com/carousels/' + dir3 + '/video/' + dir1 + '/' + dir2 + '/0/400/' common.addDirectory(name, 'cbs', 'newvideos', url) except: print 'CBS: Carousel Failed' tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) try: print 'CBS: trying secondary-show-nav-wrapper' options = tree.find(attrs={'id': 'secondary-show-nav-wrapper'}) options = options.findAll('a') for option in options: name = option.string.encode('utf-8') url = BASE + option['href'] common.addDirectory(name, 'cbs', 'videos', url) print 'CBS: trying vid_module' options = tree.findAll(attrs={'class': 'vid_module'}) for option in options: moduleid = option['id'] name = option.find(attrs={'class': 'hdr'}).string common.addDirectory(name, 'cbs', 'showsubcats', url + '<moduleid>' + moduleid) except: print 'CBS: secondary-show-nav-wrapper failed' print 'CBS: trying vid_module secondary' options = tree.findAll(attrs={'class': 'vid_module'}) for option in options: moduleid = option['id'] name = option.find(attrs={'class': 'hdr'}).string common.addDirectory(name, 'cbs', 'showsubcats', url + '<moduleid>' + moduleid) common.setView('seasons')