def show(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.find('ul', attrs={ 'id': 'browse_results' }).findAll('li', recursive=False) for video in videos: infoLabels = {} link = video.find('a') thumb = video.find('img')['src'] url = BASE + link['href'] infoLabels['Title'] = link['title'] #infoLabels['premiered']=video.find('p',attrs={'class':'browse_result_sale grid-hidden'}) infoLabels['Plot'] = video.find('div', attrs={ 'class': 'browse_result_description' }).string.strip() infoLabels['TVShowTitle'] = common.args.name try: infoLabels['Duration'] = video.find('span', attrs={ 'class': 'duration' }).string.strip('()') except: pass u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="marvel"' u += '&sitemode="play"' common.addVideo(u, infoLabels['Title'], thumb, infoLabels=infoLabels) common.setView('episodes')
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')
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')
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')
def sp_episodes(): import demjson xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_EPISODE) url = 'http://www.southparkstudios.com/feeds/full-episode/carousel/'+common.args.url+'/dc400305-d548-4c30-8f05-0f27dc7e0d5c' json = common.getURL(url) episodes = demjson.decode(json)['season']['episode'] for episode in episodes: title = episode['title'] description = episode['description'].encode('ascii', 'ignore') thumbnail = episode['thumbnail'].replace('width=55','') episodeid = episode['id'] senumber = episode['episodenumber'] date = episode['airdate'].replace('.','-') seasonnumber = senumber[:-2] episodenumber = senumber[len(seasonnumber):] try: season = int(seasonnumber) episode = int(episodenumber) except: season = 0 episode = 0 u = sys.argv[0] u += '?url="'+urllib.quote_plus(episodeid)+'"' u += '&mode="comedy"' u += '&sitemode="sp_play"' infoLabels={ "Title": title, "Season":season, "Episode":episode, "premiered":date, "Plot":description, "TVShowTitle":"South Park" } common.addVideo(u,title,thumbnail,infoLabels=infoLabels) common.setView('episodes')
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')
def newvideos(url = common.args.url): data = common.getURL(url) itemList = demjson.decode(data)['itemList'] for video in itemList: url = video['pid'] description = video['description'] thumb = video['thumbnail'] seriesTitle = video['seriesTitle'] title = video['label'] try:episodeNum = int(video['episodeNum']) except:episodeNum = 0 try:seasonNum = int(video['seasonNum']) except:seasonNum = 0 duration = int(video['duration']) airDate = video['_airDate'] rating = video['rating'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="cbs"' u += '&sitemode="play"' displayname = '%sx%s - %s' % (seasonNum,episodeNum,title) infoLabels={ "Title":title, "Plot":description, "Season":seasonNum, "Episode":episodeNum, "premiered":airDate, "Duration":str(duration), "mpaa":rating, "TVShowTitle":seriesTitle } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
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')
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')
def episodes(): url = 'http://www.nick.com/ajax/videos/full-episode-videos' url += '?sort=date+desc&start=0&viewType=videoContentList&rows=25&artist=&show='+common.args.url+'&f_type=&f_contenttype=' data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes=tree.findAll('article') for episode in episodes: name = episode.find('p',attrs={'class':'short-title'}).string showname = episode.find('p',attrs={'class':'show-name'}).string plot = episode.find('p',attrs={'class':'description'}).string thumb = episode.find('img',attrs={'class':'thumbnail'})['src'] dataid = episode['data-id'] url = BASE + episode.find('a')['href'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="nick"' u += '&sitemode="playvideo"' infoLabels={ "Title":name, #"Duration":duration, #"Season":season, #"Episode":episode, "Plot":str(plot), "TVShowTitle":showname } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def showsubClips(url = common.args.url): xbmcplugin.setContent(int(sys.argv[1]), 'episodes') data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos=tree.find('div',attrs={'class' : 'scet-browse-group detail-short-clips-view '}).findAll('div',attrs={'class' : 'thumb-block '}) for video in videos: #print video.prettify() url = BASE + video.find('a')['href'] thumb = video.find('img')['src'].replace('w=131&h=74','w=446&h=248') name = video.find('div',attrs={'class' : 'title'}).string.strip() showname = video.find('div',attrs={'class' : 'type'}).string.strip() description = video.find('p',attrs={'class' : 'description'}).find('span').string duration = video.find('div',attrs={'class' : 'runtime'}).string.split(':',1)[1].strip() u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="nbc"' u += '&sitemode="play"' infoLabels={ "Title":name, #"Season":season, #"Episode":episode, "Plot":description, #"premiered":airDate, "Duration":duration, "TVShowTitle":showname } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
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')
def processMovies(url): data = common.getURL(url) remove = re.compile('<script.*?script>', re.DOTALL) data = re.sub(remove, '', data) remove = re.compile('<\\!--.*?-->', re.DOTALL) data = re.sub(remove, '', data) htmldata = demjson.decode(data)['display'] remove = re.compile('"<div.*?div>"') htmldata = re.sub(remove, '""', htmldata) tree=BeautifulSoup(htmldata, convertEntities=BeautifulSoup.HTML_ENTITIES) #print tree.prettify() episodes = tree.findAll('div',attrs={'class':re.compile('video-image-wrapper video')}) if len(episodes) == 0: return False for episode in episodes: print episode.prettify() url = episode.find('a')['href'] try: name = episode.find('b').string except: name = episode.find('img')['title'] thumb = episode.find('img')['src'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="lifetime"' u += '&sitemode="playepisode"' infoLabels={ "Title":name, "TVShowTitle":common.args.name} common.addVideo(u,name,thumb,infoLabels=infoLabels) return True
def videos(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) subs = tree.find(attrs={'class': 'group-b'}) try: try: finalsubs = subs.find(attrs={ 'class': 'video-list' }).findAll('tr', attrs={'class': True}) except: try: finalsubs = subs.find(attrs={ 'id': "vid_mod_1" }).findAll(attrs={'itemscope': True}) except: finalsubs = tree.find(attrs={ 'id': "vid_mod_1" }).findAll(attrs={'itemscope': True}) for sub in finalsubs: sub = sub.find('a') name = sub.string url = sub['href'] if BASE not in url: url = BASE + url u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="vh1"' u += '&sitemode="playurl"' common.addVideo(u, name, '', infoLabels={"Title": name}) common.setView('episodes') except: print 'No videos'
def episodes(): url = 'http://www.nick.com/ajax/all-videos-list/full-episode-videos' url += '?orderBy=Date&start=0&rows=25&type=videoplaylist-segmented&tag=' + common.args.url #url = 'http://www.nick.com/ajax/videos/full-episode-videos' #url += '?sort=date+desc&start=0&viewType=videoContentList&rows=25&artist=&show='+common.args.url+'&f_type=&f_contenttype=' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes = tree.findAll('article') for episode in episodes: print episode.prettify() name = episode.find('p', attrs={'class': 'short-title'}).string showname = episode.find('p', attrs={'class': 'show-name'}).string plot = episode.find('p', attrs={'class': 'description'}).string thumb = episode.find('img', attrs={'class': 'thumbnail'})['src'] #dataid = episode['data-id'] #dataid = '' url = BASE + episode.find('a')['href'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="nick"' u += '&sitemode="playvideo"' infoLabels = { "Title": name, #"Duration":duration, #"Season":season, #"Episode":episode, "Plot": str(plot), "TVShowTitle": showname } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def sp_episodes(): import demjson xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_EPISODE) url = 'http://www.southparkstudios.com/feeds/full-episode/carousel/' + common.args.url + '/dc400305-d548-4c30-8f05-0f27dc7e0d5c' json = common.getURL(url) episodes = demjson.decode(json)['season']['episode'] for episode in episodes: title = episode['title'] description = episode['description'].encode('ascii', 'ignore') thumbnail = episode['thumbnail'].replace('width=55', '') episodeid = episode['id'] senumber = episode['episodenumber'] date = episode['airdate'].replace('.', '-') seasonnumber = senumber[:-2] episodenumber = senumber[len(seasonnumber):] try: season = int(seasonnumber) episode = int(episodenumber) except: season = 0 episode = 0 u = sys.argv[0] u += '?url="' + urllib.quote_plus(episodeid) + '"' u += '&mode="comedy"' u += '&sitemode="sp_play"' infoLabels = { "Title": title, "Season": season, "Episode": episode, "premiered": date, "Plot": description, "TVShowTitle": "South Park" } common.addVideo(u, title, thumbnail, infoLabels=infoLabels) common.setView('episodes')
def episodes(): url = 'http://www.teennick.com/ajax/videos/all-videos/'+common.args.url url += '?sort=date+desc&start=0&page=1&viewType=collectionAll&type=fullEpisodeItem' data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes=tree.find('ul',attrs={'class':'large-grid-list clearfix'}).findAll('li',recursive=False) for episode in episodes: h4link=episode.find('h4').find('a') name = h4link.string url = BASE + h4link['href'] thumb = episode.find('img')['src'].split('?')[0] plot = episode.find('p',attrs={'class':'description text-small color-light'}).string u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="nickteen"' u += '&sitemode="playvideo"' infoLabels={ "Title":name, #"Duration":duration, #"Season":0, #"Episode":0, "Plot":str(plot), "TVShowTitle":common.args.name } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def addVideos(tree): episodes = tree.find('ul', attrs={ 'class': 'grid cf' }).findAll('li', recursive=False) showname = tree.find('h3', attrs={ 'id': 'natgeov-section-title' }).contents[0] for episode in episodes: vidthumb = episode.find('div', attrs={'class': 'vidthumb'}) name = vidthumb.find('a')['title'] thumb = BASE + vidthumb.find('img')['src'] duration = vidthumb.find('span', attrs={ 'class': 'vidtimestamp' }).string url = BASE + vidthumb.find('a')['href'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="natgeo"' u += '&sitemode="play"' infoLabels = { "Title": name, "Duration": duration, #"Season":season, #"Episode":episode, #"Plot":str(plot), "TVShowTitle": showname } common.addVideo(u, name, thumb, infoLabels=infoLabels)
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')
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')
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')
def episodesRSS(url=common.args.url): data = common.getURL(url) tree=BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) menu=tree.findAll('item') for item in menu: namedata = item('title')[0].string.encode('utf-8').split(' Full Episode - ') name = namedata[0] season = int(namedata[1].split(' - ')[0].split(' | ')[1].replace('s','')) episode = int(namedata[1].split(' - ')[0].split(' | ')[0].replace('e','')) tvshow = namedata[1].split(' - ')[1] url = item('link')[0].string thumb = item('image')[0].string airDate = item('pubdate')[0].string.split('T')[0] descriptiondata = re.compile('<p>(.+?)</p>').findall(item('description')[0].string)[0].split('<br>') description = descriptiondata[0] duration = descriptiondata[-2].replace('Duration: ','') displayname = '%sx%s - %s' % (str(season),str(episode),name) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="abc"' u += '&sitemode="play"' infoLabels={ "Title":name, "Season":season, "Episode":episode, "Plot":description, "premiered":airDate, "Duration":duration, "TVShowTitle":tvshow } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
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')
def videosHTML(url=common.args.url): print "Using html" data = common.getURL(url) tree=BeautifulSoup(data,convertEntities=BeautifulSoup.HTML_ENTITIES) items = tree.find('ul',attrs={'class':'media-thumbs media-thumbs-videos clearfix'}).findAll('li') for item in items: title = item.find('a').string.strip() plot = item.findAll('p')[1].string thumb = item['style'].split('url(')[1].replace(')','') duration = item.find('span').string.strip('()') url = BASE+ item.find('a')['href'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' 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')
def episodes(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.find(attrs={'id':'fullEpisodesList'}).findAll(attrs={'data-video-id':True}) for item in menu: videoObject = demjson.decode(item.find('script',attrs={'class':'videoObject','type':'application/json'}).string) thumb = videoObject['videoStillURL'] url = videoObject['videoURL'] videoid = str(item['data-video-id']).encode('utf-8') name = item.find(attrs={'class':'episodeName'}).find('a').string duration = item.find(attrs={'class':'episodeName'}).contents[2].string.replace('(','').replace(')','') episodenumber = item.find(attrs={'class':'episodeNumber'}).contents[1].split('/') season = int(episodenumber[0]) episode = int(episodenumber[1]) description = item.find(attrs={'class':'description'}).string airDate = item.find(attrs={'class':'airDate'}).string displayname = '%sx%s - %s' % (str(season),str(episode),name) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="fox"' u += '&sitemode="play"' 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')
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')
def fullepisodes(url=common.args.url): url = 'http://www.kidswb.com/video/playlists?pid=channel&chan=' + url data = common.getURL(url) html = demjson.decode(data)['list_html'] tree = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES).find( 'ul', attrs={'id': 'videoList_ul'}) if tree: videos = tree.findAll('li', recursive=False) for video in videos: infoLabels = {} vid_id = video['id'][6:] thumb = video.find('img')['src'] infoLabels['Title'] = video.find('span', attrs={ 'id': 'vidtitle_' + vid_id }).string infoLabels['TVShowTitle'] = video.find('p', attrs={ 'class': 'vidtitle' }).contents[1] infoLabels['Plot'] = video.find('p', attrs={ 'id': 'viddesc_' + vid_id }).string u = sys.argv[0] u += '?url="' + urllib.quote_plus(vid_id) + '"' u += '&mode="thewbkids"' u += '&sitemode="play"' common.addVideo(u, infoLabels['Title'], thumb, infoLabels=infoLabels) common.setView('episodes')
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')
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')
def episodes(): url = 'http://nicktoons.nick.com/ajax/videos/all-videos/' + common.args.url url += '?sort=date+desc&start=0&page=1&viewType=collectionAll&type=fullEpisodeItem' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes = tree.find('ul', attrs={ 'class': 'large-grid-list clearfix' }).findAll('li', recursive=False) for episode in episodes: h4link = episode.find('h4').find('a') name = h4link.string url = BASE + h4link['href'] thumb = episode.find('img')['src'].split('?')[0] plot = episode.find('p', attrs={ 'class': 'description text-small color-light' }).string u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="nicktoons"' u += '&sitemode="playvideo"' infoLabels = { "Title": name, #"Duration":duration, #"Season":0, #"Episode":0, "Plot": str(plot), "TVShowTitle": common.args.name } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def showroot(id=common.args.url): url = build_api_url('channel','',ID=id) data = common.getURL(url) if data: items = demjson.decode(data)['FolderList'] for item in items: if 'Full Episodes'==item['Name'] or 'Television Clips & Trailers'==item['Name'] or 'Minisodes'==item['Name'] or 'Original Series'==item['Name'] or 'Movie'==item['Name'] or 'Movie Clips & Trailers'==item['Name']: for season in item['PlaylistList']: for video in season['MediaList']: thumb=video['ThumbnailExternal'] ID=str(video['ID']) url = video['DetailsURL'] infoLabels={} infoLabels['Title']=video['Title'] infoLabels['Duration']=video['Duration'] try:infoLabels['Season']=int(video['Season']) except:pass try:infoLabels['Episode']=int(video['Episode']) except:pass infoLabels['MPAA']=video['Rating'] infoLabels['Genre']=video['Genre'] infoLabels['TVShowTitle']=video['ParentChannelName'] infoLabels['Plot']=video['Description'] try:infoLabels['AirDate']=common.formatDate(video['ReleaseDate'],'%m/%d/%Y') except: print video['ReleaseDate'] displayname=infoLabels['Title'] if infoLabels.has_key('Season') or infoLabels.has_key('Episode'): displayname = str(infoLabels['Season'])+'x'+str(infoLabels['Episode'])+' - '+infoLabels['Title'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(ID)+'"' u += '&mode="crackle"' u += '&sitemode="play"' common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def episode(): cid = common.args.url showname = common.args.name #url = 'http://www.tnt.tv/processors/services/getCollectionByContentId.do?offset=0&sort=&limit=200&id='+cid #url = 'http://www.tnt.tv/content/services/getCollectionByContentId.do?site=true&offset=0&sort=&limit=200&id='+cid url = 'http://www.tnt.tv/video/content/services/getCollectionByContentId.do?offset=0&sort=&limit=200&id='+cid html=common.getURL(url) tree=BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) episodes = tree.findAll('episode') for episode in episodes: episodeId = episode['id'] name = episode.find('title').string thumbnail = episode.find('thumbnailurl').string plot = episode.find('description').string duration = episode.find('duration').string try:seasonNum = int(episode.find('seasonnumber').string) except:seasonNum = 0 try: episodeNum = episode.find('episodenumber').string if len(episodeNum) > 2 and episodeNum.startswith(str(seasonNum)): episodeNum = episodeNum[1:] if len(episodeNum) > 2: episodeNum = episodeNum[-2:] print episodeNum episodeNum = int(episodeNum) except:episodeNum = 0 try:duration = episode.find('duration').string.strip() except: duration = '' try: mpaa = episode.find('tvratingcode').string.strip() except: mpaa = '' try: airdate = common.formatDate(episode.find('expirationdate').string,'%m/%d/%Y') except: airdate = '' displayname=name if episodeNum <> 0 or seasonNum <> 0: displayname = str(seasonNum)+'x'+str(episodeNum)+' - '+name segments = episode.findAll('segment') if len(segments) == 0: url = episodeId mode = 'play' else: url = '' for segment in segments: url += segment['id']+'<segment>' mode = 'playepisode' #PLAYEPISODE u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="tnt"' u += '&sitemode="'+mode+'"' infoLabels={ "Title":name, "Plot":plot, "Season":seasonNum, "Duration":duration, "MPAA":mpaa, "premiered":airdate, "Episode":episodeNum, "TVShowTitle":showname } common.addVideo(u,displayname,thumbnail,infoLabels=infoLabels) common.setView('episodes')
def VIDEOLINKS(data): print "Entering VIDEOLINKS function" tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) vidfeed = tree.find(attrs={'class': 'vids_feed'}) videos = vidfeed.findAll(attrs={'class': 'floatLeft', 'style': True}) for video in videos: thumb = video.find('img')['src'] vidtitle = video.find(attrs={'class': 'vidtitle'}) pid = vidtitle['href'].split('pid=')[1].split('&')[0] displayname = vidtitle.string.encode('utf-8') try: title = displayname.split('-')[1].strip() series = displayname.split('-')[0].strip() except: print 'title/series metadata failure' title = displayname series = '' metadata = video.find(attrs={ 'class': 'season_episode' }).renderContents() try: duration = metadata.split('(')[1].replace(')', '') except: print 'duration metadata failure' duration = '' try: aired = metadata.split('<')[0].split(':')[1].strip() except: print 'air date metadata failure' aired = '' try: seasonepisode = thumb.split('/')[-1].split('_')[2] if 3 == len(seasonepisode): season = int(seasonepisode[:1]) episode = int(seasonepisode[-2:]) elif 4 == len(seasonepisode): season = int(seasonepisode[:2]) episode = int(seasonepisode[-2:]) if season <> 0 or episode <> 0: displayname = '%sx%s - %s' % (str(season), str(episode), title) except: print 'season/episode metadata failed' season = 0 episode = 0 u = sys.argv[0] u += '?url="' + urllib.quote_plus(pid) + '"' u += '&mode="cbs"' u += '&sitemode="play"' infoLabels = { "Title": title, "Season": season, "Episode": episode, "premiered": aired, "Duration": duration, "TVShowTitle": series } common.addVideo(u, displayname, thumb, infoLabels=infoLabels) common.setView('episodes')
def showsubFullEpisode(url=common.args.url): xbmcplugin.setContent(int(sys.argv[1]), 'episodes') data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) titledata = tree.find('h3', attrs={ 'class': 'scet-browse-heading' }).string.split(':') showname = titledata[0].strip() try: season = int(titledata[1].replace('Season', '').strip()) except: season = 0 videos = tree.find('div', attrs={ 'class': 'scet-browse-group detail-full-episodes-view' }).findAll('div', attrs={'class': 'thumb-block'}) for video in videos: #print video.prettify() url = BASE + video.find('a')['href'] thumb = video.find('img')['src'].replace('w=131&h=74', 'w=446&h=248') name = video.find('div', attrs={'class': 'title'}).string.strip() description = video.find('p', attrs={ 'class': 'description' }).find('span').string airDateData = video.find('div', attrs={ 'class': 'air-date' }).string.split(':')[1].strip() airDate = time.strftime('%Y-%d-%m', time.strptime(airDateData, '%m/%d/%y')) year = int(time.strftime('%Y', time.strptime(airDateData, '%m/%d/%y'))) date = time.strftime('%d.%m.%Y', time.strptime(airDateData, '%m/%d/%y')) duration = video.find('div', attrs={ 'class': 'runtime' }).string.split(':', 1)[1].strip() mpaa = video.find('div', attrs={'class': 'meta rating'}).string if mpaa == None: mpaa = '' u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="nbc"' u += '&sitemode="play"' infoLabels = { "Title": name, "Season": season, "MPAA": mpaa, #"Episode":episode, "Plot": description, "date'": date, "aired": airDate, "year": year, "Duration": duration, "TVShowTitle": showname } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def VIDEOLINKS( data ): print "Entering VIDEOLINKS function" tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) vidfeed=tree.find(attrs={'class' : 'vids_feed'}) videos = vidfeed.findAll(attrs={'class' : 'floatLeft','style' : True}) for video in videos: thumb = video.find('img')['src'] vidtitle = video.find(attrs={'class' : 'vidtitle'}) pid = vidtitle['href'].split('pid=')[1].split('&')[0] displayname = vidtitle.string.encode('utf-8') try: title = displayname.split('-')[1].strip() series = displayname.split('-')[0].strip() except: print 'title/series metadata failure' title = displayname series = '' metadata = video.find(attrs={'class' : 'season_episode'}).renderContents() try: duration = metadata.split('(')[1].replace(')','') except: print 'duration metadata failure' duration = '' try: aired = metadata.split('<')[0].split(':')[1].strip() except: print 'air date metadata failure' aired = '' try: seasonepisode = thumb.split('/')[-1].split('_')[2] if 3 == len(seasonepisode): season = int(seasonepisode[:1]) episode = int(seasonepisode[-2:]) elif 4 == len(seasonepisode): season = int(seasonepisode[:2]) episode = int(seasonepisode[-2:]) if season <> 0 or episode <> 0: displayname = '%sx%s - %s' % (str(season),str(episode),title) except: print 'season/episode metadata failed' season = 0 episode = 0 u = sys.argv[0] u += '?url="'+urllib.quote_plus(pid)+'"' u += '&mode="cbs"' u += '&sitemode="play"' infoLabels={ "Title":title, "Season":season, "Episode":episode, "premiered":aired, "Duration":duration, "TVShowTitle":series } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def episodes(url=common.args.url): urldata = url.split('<videotab>') tabid = int(urldata[1]) url = urldata[0] data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.find(attrs={'id':'cw-content'}).findAll(attrs={'class':'videotabcontents'}) for item in menu: itemid = int(item['id'].replace('videotabcontents_','')) if tabid == itemid: videos=item.findAll('div',recursive=False) for video in videos: print video.prettify() url = video.find('a')['href'].split('=')[1] print url thumb = video.find('img')['src'] name = video.find(attrs={'class':'t1'}).string.title() description = video.find(attrs={'class':'d3'}).string #try: # description = hoverinfo.contents[2].strip() #except: # print 'description failure' # description = '' try: airdate = hoverinfo.contents[0].contents[2].replace('Original Air Date: ','') except: print 'airdate failure' airdate='' try: duration = hoverinfo.contents[0].contents[4].strip() except: print 'duration failure' duration = '' try: seasonepisode = hoverinfo.contents[0].contents[0].replace('Season ','').split(', EP. ') season = int(seasonepisode[0]) episode = int(seasonepisode[1]) displayname = '%sx%s - %s' % (str(season),str(episode),name) except: displayname = name season = 0 episode = 0 u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="thecw"' u += '&sitemode="play"' 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')
def show(program_id=common.args.url): start = 0 count = 200 clips = False data = cove.videos.filter(fields='associated_images,mediafiles',filter_program=program_id,order_by='-airdate',filter_availability_status='Available',limit_start=start,filter_type='Episode',filter_mediafile_set__video_encoding__mime_type='video/mp4') if data['count'] == 0: clips = True data = cove.videos.filter(fields='associated_images,mediafiles',filter_program=program_id,order_by='-airdate',filter_availability_status='Available',limit_start=start,filter_mediafile_set__video_encoding__mime_type='video/mp4') videos = data['results'] total = data['count'] stop = data['stop'] for video in videos: infoLabels={} try:thumb=video['associated_images'][0]['url'] except:thumb=video['associated_images'][0]['url'] url=video['mediafiles'][0]['video_data_url'] infoLabels['Title']=video['title'] infoLabels['Plot']=video['long_description'] infoLabels['Premiered']=video['airdate'].split(' ')[0] infoLabels['TVShowTitle']=common.args.name infoLabels['Duration']=str(int(video['mediafiles'][0]['length_mseconds'])/1000) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="pbskids"' u += '&sitemode="play"' print "U1U",u common.addVideo(u,infoLabels['Title'],thumb,infoLabels=infoLabels) start = stop while start < count: if clips: data = cove.videos.filter(fields='associated_images,mediafiles',filter_program=program_id,order_by='-airdate',filter_availability_status='Available',limit_start=start) else: data = cove.videos.filter(fields='associated_images,mediafiles',filter_program=program_id,order_by='-airdate',filter_availability_status='Available',limit_start=start,filter_type='Episode') videos = data['results'] total = data['count'] stop = data['stop'] del data for video in videos: infoLabels={} try:thumb=video['associated_images'][2]['url'] except:thumb=video['associated_images'][0]['url'] url=video['mediafiles'][0]['video_data_url'] infoLabels['Title']=video['title'] infoLabels['Plot']=video['long_description'] infoLabels['Premiered']=video['airdate'].split(' ')[0] infoLabels['TVShowTitle']=common.args.name infoLabels['Duration']=str(int(video['mediafiles'][0]['length_mseconds'])/1000) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="pbskids"' u += '&sitemode="play"' print "U*U",u common.addVideo(u,infoLabels['Title'],thumb,infoLabels=infoLabels) start = stop common.setView('episodes')
def episodes(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes = tree.findAll(attrs={'class': 'episodeContainer'}) for episode in episodes: seasonepisode = episode.find(attrs={ 'class': 'episodeIdentifier' }).string.split('#')[1] airDate = episode.find(attrs={ 'class': 'episodeAirDate' }).contents[1].strip() description = episode.find(attrs={ 'class': 'episodeDescription' }).contents[0].strip() try: duration = episode.find(attrs={ 'class': 'episodeDuration' }).string.replace(')', '').replace('(', '') except: duration = '' episodeTitle = episode.find(attrs={'class': 'episodeTitle'}).find('a') name = episodeTitle.string url = episodeTitle['href'] thumb = episode.find(attrs={ 'class': 'episodeImage' }).find('img')['src'].split('?')[0] try: if 3 == len(seasonepisode): season = int(seasonepisode[:1]) episode = int(seasonepisode[-2:]) elif 4 == len(seasonepisode): season = int(seasonepisode[:2]) episode = int(seasonepisode[-2:]) if season <> 0 or episode <> 0: displayname = '%sx%s - %s' % (str(season), str(episode), name) except: print 'no season data' displayname = name season = 0 episode = 0 u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="tvland"' u += '&sitemode="playurl"' 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')
def showroot(id=common.args.url): url = build_api_url('channel', '', ID=id) data = common.getURL(url) if data: items = demjson.decode(data)['FolderList'] for item in items: if 'Full Episodes' == item[ 'Name'] or 'Television Clips & Trailers' == item[ 'Name'] or 'Minisodes' == item[ 'Name'] or 'Original Series' == item[ 'Name'] or 'Movie' == item[ 'Name'] or 'Movie Clips & Trailers' == item[ 'Name']: for season in item['PlaylistList']: for video in season['MediaList']: thumb = video['ThumbnailExternal'] ID = str(video['ID']) url = video['DetailsURL'] infoLabels = {} infoLabels['Title'] = video['Title'] infoLabels['Duration'] = video['Duration'] try: infoLabels['Season'] = int(video['Season']) except: pass try: infoLabels['Episode'] = int(video['Episode']) except: pass infoLabels['MPAA'] = video['Rating'] infoLabels['Genre'] = video['Genre'] infoLabels['TVShowTitle'] = video['ParentChannelName'] infoLabels['Plot'] = video['Description'] try: infoLabels['AirDate'] = common.formatDate( video['ReleaseDate'], '%m/%d/%Y') except: print video['ReleaseDate'] displayname = infoLabels['Title'] if infoLabels.has_key('Season') or infoLabels.has_key( 'Episode'): displayname = str( infoLabels['Season']) + 'x' + str( infoLabels['Episode'] ) + ' - ' + infoLabels['Title'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(ID) + '"' u += '&mode="crackle"' u += '&sitemode="play"' common.addVideo(u, displayname, thumb, infoLabels=infoLabels) common.setView('episodes')
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') print "PP12",episode.findAll('p')[1].contents[1] #slces 26.04.2013 changed index airDate = episode.findAll('p')[1].contents[1].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')
def stprocessvideos(purl): print "enter stprocessvideos" stbase = 'http://www.startrek.com' xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) data = common.getURL(purl) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.find(attrs={'class': 'videos_container'}).findAll('li') for video in videos: thumb = video.find('img')['src'] url = stbase + video.find('a')['href'] try: showname, name = video.findAll('a')[1].string.split('-') except: name = video.findAll('a')[1].string showname = '' try: seasonepisode, duration = video.findAll('p') seasonepisode = seasonepisode.string.replace('Season ', '').split(' Ep. ') season = int(seasonepisode[0]) episode = int(seasonepisode[1]) duration = duration.string.split('(')[1].replace(')', '') except: season = 0 episode = 0 duration = '' if season <> 0 or episode <> 0: displayname = '%sx%s - %s' % (str(season), str(episode), name) else: displayname = name u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="cbs"' u += '&sitemode="playST"' infoLabels = { "Title": displayname, "Season": season, "Episode": episode, #"premiered":aired, "Duration": duration, "TVShowTitle": showname } common.addVideo(u, displayname, thumb, infoLabels=infoLabels) if len(videos) == 4: if '/page_full/' not in purl and '/page_other/' not in purl: nurl = purl + '/page_other/2' else: page = int(purl.split('/')[-1]) nextpage = page + 1 nurl = purl.replace('/' + str(page), '/' + str(nextpage)) stprocessvideos(nurl)
def process(urlBase, fullname = common.args.url): #url = 'http://feed.theplatform.com/f/OyMl-B/Y3vAV4MxgwlM' url = urlBase url += '&form=json' #url += '&fields=guid,title,description,categories,content,defaultThumbnailUrl' url += '&fileFields=duration,url,width,height' url += '&count=true' url += '&byCategories='+urllib.quote_plus(fullname) #url += '&byCustomValue={fullEpisode}{true}' data = common.getURL(url) episodes = demjson.decode(data)['entries'] for episode in episodes: print episode try: name = episode['title'].split(':')[1].strip() seasonEpisode =episode['title'].split(':')[0].strip() season = int(seasonEpisode[:1]) episodeNum = int(seasonEpisode[1:]) except: name = episode['title'] season=0 episodeNum=0 description = episode['description'] try: thumb= episode['plmedia$defaultThumbnailUrl'] except: print "no thumb for",name duration=str(int(episode['media$content'][0]['plfile$duration'])) airDate = common.formatDate(epoch=episode['pubDate']/1000) #print "vid url",url url=episode['media$content'][0]['plfile$url'] if season <> 0 and episodeNum <> 0: displayname = '%sx%s - %s' % (str(season),str(episodeNum),name) elif season <> 0: displayname = '%S%s - %s' % (str(season),name) else: displayname = name u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="usa"' u += '&sitemode="play"' infoLabels={ "Title":name, "Season":season, "Episode":episodeNum, "Plot":description, "premiered":airDate, "Duration":duration, "TVShowTitle":common.args.name } common.addVideo(u,displayname,thumb,infoLabels=infoLabels)
def addvideos(videos): for video in videos: link = video.find('a', attrs={'class':'thumbnailLink'}) url = 'http://vod.fxnetworks.com'+link['href'] thumb = link.find('img')['src'] title = video.find('a', attrs={'class':'thumbnailLinkText'}).string seasonNum = video.find('p', attrs={'class':'seasonNum'}).string name = seasonNum+' '+title u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="fx"' u += '&sitemode="play"' infoLabels={ "Title":title} common.addVideo(u,name,thumb,infoLabels=infoLabels)
def addvideos(videos): for video in videos: link = video.find("a", attrs={"class": "thumbnailLink"}) url = "http://vod.fxnetworks.com" + link["href"] thumb = link.find("img")["src"] title = video.find("a", attrs={"class": "thumbnailLinkText"}).string seasonNum = video.find("p", attrs={"class": "seasonNum"}).string name = seasonNum + " " + title u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="fx"' u += '&sitemode="play"' infoLabels = {"Title": title} common.addVideo(u, name, thumb, infoLabels=infoLabels)
def stprocessvideos(purl): print "enter stprocessvideos" stbase = 'http://www.startrek.com' xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) data = common.getURL(purl) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos=tree.find(attrs={'class' : 'videos_container'}).findAll('li') for video in videos: thumb = video.find('img')['src'] url = stbase+video.find('a')['href'] try: showname,name = video.findAll('a')[1].string.split('-') except: name = video.findAll('a')[1].string showname = '' try: seasonepisode, duration = video.findAll('p') seasonepisode = seasonepisode.string.replace('Season ','').split(' Ep. ') season = int(seasonepisode[0]) episode = int(seasonepisode[1]) duration = duration.string.split('(')[1].replace(')','') except: season = 0 episode = 0 duration = '' if season <> 0 or episode <> 0: displayname = '%sx%s - %s' % (str(season),str(episode),name) else: displayname = name u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="cbs"' u += '&sitemode="playST"' infoLabels={ "Title":displayname, "Season":season, "Episode":episode, #"premiered":aired, "Duration":duration, "TVShowTitle":showname } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) if len(videos) == 4: if '/page_full/' not in purl and '/page_other/' not in purl: nurl = purl+'/page_other/2' else: page = int(purl.split('/')[-1]) nextpage = page + 1 nurl = purl.replace('/'+str(page),'/'+str(nextpage)) stprocessvideos(nurl)
def fullepisodes(url=common.args.url): if (common.settings['enableproxy'] == 'true'): proxy = True else: proxy = False data = common.getURL(url, proxy=proxy) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes = tree.find('div', attrs={ 'id': 'full_ep_car' }).findAll('div', attrs={ 'id': True, 'class': True }) for episode in episodes: links = episode.findAll('a') url = BASE + links[1]['href'] showname = links[1].find('strong').string name = links[0].find('img')['title'].replace( showname, '').strip().encode('utf-8') thumb = links[0].find('img')['src'] plot = episode.findAll('p')[1].string try: seasonEpisode = episode.find('span', attrs={ 'class': 'type' }).string seasonSplit = seasonEpisode.split(': Ep. ') season = int(seasonSplit[0].replace('Season', '').strip()) episodeSplit = seasonSplit[1].split(' ') episode = int(episodeSplit[0]) duration = episodeSplit[1].replace('(', '').replace(')', '').strip() displayname = '%sx%s - %s' % (str(season), str(episode), name) except: season = 0 episode = 0 duration = '' displayname = name u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="thewb"' u += '&sitemode="play"' infoLabels = { "Title": name, "Duration": duration, "Season": season, "Episode": episode, "Plot": plot, "TVShowTitle": showname } common.addVideo(u, displayname, thumb, infoLabels=infoLabels) common.setView('episodes')
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')
def newvideos2(url = common.args.url): data = common.getURL(url) itemList = demjson.decode(data)['result']['data'] for video in itemList: # data from JSON file vurl = BASE + video['url'] thumb = video['thumb']['large'] seriesTitle = video['series_title'] title = video['label'] # need to fetch the video URL for the rest of the meta data videodata = common.getURL(vurl) videotree=BeautifulSoup(videodata, convertEntities=BeautifulSoup.HTML_ENTITIES) description = videotree.find('meta',attrs={'name' : 'description'})['content'].replace("\\'",'"') #16.04.2013 - airdate is now in JSON try: airdatediv = videotree.find('div',attrs={'class' : 'airdate'}) aird1 = str(airdatediv).split('<')[1].split(':')[1].strip() aird2 = datetime.strptime(aird1, '%m/%d/%y') airDate = datetime.strftime(aird2, '%Y-%m-%d') except: airDate = 0 metadiv = videotree.find('div',attrs={'class' : 'title'}) # <span>S6 Ep18 (20:12) --> [(u'6', u'18', u'20', u'12')] meta = re.compile("<span>S(\d+)\D+(\d+)\D+(\d+)\:(\d+)").findall(str(metadiv)) try:episodeNum = int(meta[0][1]) except:episodeNum = 0 try:seasonNum = int(meta[0][0]) except:seasonNum = 0 try:duration = int(meta[0][2]) except:duration = int('0') #rating = video['rating'] rating = 0 u = sys.argv[0] u += '?url="'+urllib.quote_plus(vurl)+'"' u += '&mode="cbs"' u += '&sitemode="play"' displayname = '%sx%s - %s' % (seasonNum,episodeNum,title) infoLabels={ "Title":title, "Plot":description, "Season":seasonNum, "Episode":episodeNum, "premiered":airDate, "Duration":str(duration), "mpaa":rating, "TVShowTitle":seriesTitle } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def ccepisodes(url=common.args.url): data = common.getURL(url) try: showcase=re.compile("var episodeShowcaseLlink = '(.+?)';").findall(data)[0] keepGoing=True except: keepGoing=False u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="comedy"' u += '&sitemode="playurl"' common.addVideo(u,"Play Episode") current=1 while keepGoing: showcase_url = BASE_URL+showcase+'?currentPage='+str(current) data = common.getURL(showcase_url) videos=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES).findAll('div',attrs={'itemtype':'http://schema.org/TVEpisode'}) for video in videos: infoLabels={} url=video.find('meta',attrs={'itemprop':'url'})['content'] thumb=video.find('meta',attrs={'itemprop':'image'})['content'] infoLabels['Title']=video.find('meta',attrs={'itemprop':'name'})['content'] infoLabels['Plot']=video.find('meta',attrs={'itemprop':'description'})['content'] infoLabels['premiered']=common.formatDate(video.find('meta',attrs={'itemprop':'datePublished'})['content'],'%b %d, %Y') seasonEpisode = video.find('div',attrs={'class':'video_meta'}).string.split('|')[0].split('-') infoLabels['Season'] = int(seasonEpisode[0].replace('Season','').strip()) if 'Special' not in seasonEpisode[1]: episode = seasonEpisode[1].replace('Episode','').strip() if len(episode) > 2: episode = episode[-2:] infoLabels['Episode'] = int(episode) else: infoLabels['Episode'] = 0 if infoLabels['Season'] <> 0 or infoLabels['Episode'] <> 0: displayname = '%sx%s - %s' % (infoLabels['Season'],str(infoLabels['Episode']),infoLabels['Title']) else: displayname = infoLabels['Title'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="comedy"' u += '&sitemode="playurl"' common.addVideo(u,displayname,thumb,infoLabels=infoLabels) if len(videos) < 5: keepGoing=False current+=1 common.setView('episodes')
def videos(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.findAll('section',attrs={'class' : re.compile('content-item.+?')}) for video in videos: infoLabels={} url = BASE+video.find('a')['href'] thumb = BASE+video.find('img')['src'] infoLabels['Title'] = video.find('b',attrs={'class':'content-item-subtitle'}).string infoLabels['TVShowTitle'] = str(video.find('b',attrs={'class':'content-item-brand'}).string) infoLabels['Plot'] = str(video.find('span',attrs={'class':'content-item-short-description'}).string) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="hub"' u += '&sitemode="play"' common.addVideo(u,infoLabels['Title'],thumb,infoLabels=infoLabels) common.setView('episodes')
def episodes(): data = common.getURL(common.args.url) items = demjson.decode(data)['media']['items'] xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) for item in items: infoLabels = {} name = item['title'].encode('utf-8') try: infoLabels['Season'] = int( name.split('Season')[1].split('Episode')[0].strip()) infoLabels['Episode'] = int(name.split('Episode')[1].strip()) name = name.split('Season')[0].strip() except: name = name.split('Season')[0].strip() thumb = item['thumbnail_url'] #url = item['url'] urls = item['conversions'] url = urls[len(urls) - 1]['streaming_url'] infoLabels['Title'] = name infoLabels['TVShowTitle'] = name for field in item['custom_fields']: if field['slug'] == 'season-number': infoLabels['Season'] = int(field['values'][0]) elif field['slug'] == 'episode-number': infoLabels['Episode'] = int(field['values'][0]) elif field['slug'] == 'rating': infoLabels['MPAA'] = field['values'][0] if isinstance(item['description'], types.ListType): infoLabels['Plot'] = item['description'][0].encode('utf-8') else: infoLabels['Plot'] = item['description'].encode('utf-8') if infoLabels.has_key('Episode') and infoLabels.has_key('Season'): displayname = '%sx%s - %s' % (str( infoLabels['Season']), str(infoLabels['Episode']), name) elif infoLabels.has_key('Episode'): displayname = '%s. - %s' % (str(infoLabels['Episode']), name) elif infoLabels.has_key('Season'): displayname = 'S%s - %s' % (str(infoLabels['Season']), name) else: displayname = name infoLabels['Title'] = displayname common.addVideo(url, displayname, thumb, infoLabels=infoLabels) common.setView('episodes')
def process(urlBase, fullname = common.args.url): #url = 'http://feed.theplatform.com/f/OyMl-B/Y3vAV4MxgwlM' url = urlBase url += '&form=json' #url += '&fields=guid,title,description,categories,content,defaultThumbnailUrl' url += '&fileFields=duration,url,width,height' url += '&count=true' url += '&byCategories='+urllib.quote_plus(fullname) #url += '&byCustomValue={fullEpisode}{true}' data = common.getURL(url) episodes = demjson.decode(data)['entries'] for episode in episodes: try: name = episode['title'].split(':')[1].strip() seasonEpisode =episode['title'].split(':')[0].strip() season = int(seasonEpisode[:1]) episodeNum = int(seasonEpisode[1:]) except: name = episode['title'] season=0 episodeNum=0 description = episode['description'] thumb= episode['plmedia$defaultThumbnailUrl'] duration=str(int(episode['media$content'][0]['plfile$duration'])) airDate = common.formatDate(epoch=episode['pubDate']/1000) url=episode['media$content'][0]['plfile$url'] if season <> 0 and episodeNum <> 0: displayname = '%sx%s - %s' % (str(season),str(episodeNum),name) elif season <> 0: displayname = '%S%s - %s' % (str(season),name) else: displayname = name u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="usa"' u += '&sitemode="play"' infoLabels={ "Title":name, "Season":season, "Episode":episodeNum, "Plot":description, "premiered":airDate, "Duration":duration, "TVShowTitle":common.args.name } common.addVideo(u,displayname,thumb,infoLabels=infoLabels)
def episodes(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes=tree.findAll(attrs={'class' : 'episodeContainer'}) for episode in episodes: seasonepisode = episode.find(attrs={'class' : 'episodeIdentifier'}).string.split('#')[1] airDate = episode.find(attrs={'class' : 'episodeAirDate'}).contents[1].strip() description = episode.find(attrs={'class' : 'episodeDescription'}).contents[0].strip() try: duration = episode.find(attrs={'class' : 'episodeDuration'}).string.replace(')','').replace('(','') except: duration = '' episodeTitle = episode.find(attrs={'class' : 'episodeTitle'}).find('a') name = episodeTitle.string url = episodeTitle['href'] thumb = episode.find(attrs={'class' : 'episodeImage'}).find('img')['src'].split('?')[0] try: if 3 == len(seasonepisode): season = int(seasonepisode[:1]) episode = int(seasonepisode[-2:]) elif 4 == len(seasonepisode): season = int(seasonepisode[:2]) episode = int(seasonepisode[-2:]) if season <> 0 or episode <> 0: displayname = '%sx%s - %s' % (str(season),str(episode),name) except: print 'no season data' displayname = name season = 0 episode = 0 u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="tvland"' u += '&sitemode="playurl"' 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')
def episodes(): data = common.getURL(common.args.url) items = demjson.decode(data)['media']['items'] xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) for item in items: infoLabels={} name = item['title'].encode('utf-8') try: infoLabels['Season'] = int(name.split('Season')[1].split('Episode')[0].strip()) infoLabels['Episode'] = int(name.split('Episode')[1].strip()) name = name.split('Season')[0].strip() except: name = name.split('Season')[0].strip() thumb = item['thumbnail_url'] #url = item['url'] urls = item['conversions'] url = urls[len(urls)-1]['streaming_url'] infoLabels['Title']=name infoLabels['TVShowTitle']=name for field in item['custom_fields']: if field['slug'] == 'season-number': infoLabels['Season']=int(field['values'][0]) elif field['slug'] == 'episode-number': infoLabels['Episode']=int(field['values'][0]) elif field['slug'] == 'rating': infoLabels['MPAA']=field['values'][0] if isinstance(item['description'], types.ListType): infoLabels['Plot'] = item['description'][0].encode('utf-8') else: infoLabels['Plot'] = item['description'].encode('utf-8') if infoLabels.has_key('Episode') and infoLabels.has_key('Season'): displayname = '%sx%s - %s' % (str(infoLabels['Season']),str(infoLabels['Episode']),name) elif infoLabels.has_key('Episode'): displayname = '%s. - %s' % (str(infoLabels['Episode']),name) elif infoLabels.has_key('Season'): displayname = 'S%s - %s' % (str(infoLabels['Season']),name) else: displayname=name infoLabels['Title']=displayname common.addVideo(url,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')