def episodes(episode_url=_common.args.url): episode_data = _connection.getURL(episode_url) episode_tree = BeautifulSoup(episode_data.replace('\'+\'', ''), 'html.parser') if _common.args.name == 'Clips': if episode_tree.find('a', class_='next') is not None: add_clips(episode_tree) try: episodes( episode_url.split('?')[0] + episode_tree.find('a', class_='next')['href']) except: pass else: add_clips(episode_tree) else: if episode_tree.find('a', class_='season_menu') is not None: show_id = re.compile('var showId = "(.+?)";').findall( episode_data)[0] episode_id = re.compile('var episodeId = "(.+?)";').findall( episode_data)[0] episode_menu = episode_tree.find_all('a', class_='season') for episode_item in episode_menu: episode_data2 = _connection.getURL( SEASONURL % (show_id, episode_item['id'], episode_id)) episode_tree2 = BeautifulSoup(episode_data2) add_fullepisodes(episode_tree2, episode_item.text.split(' ')[1]) else: add_fullepisodes(episode_tree) _common.set_view('episodes')
def episodes(episode_url=_common.args.url): episode_data = _connection.getURL(EPISODES + episode_url) episode_data2 = simplejson.loads(episode_data)['list_html'] episode_tree = BeautifulSoup(episode_data2, 'html.parser').find('ul', id='videoList_ul') if episode_tree: episode_menu = episode_tree.find_all('li', recursive=False) for episode_item in episode_menu: infoLabels = {} url = episode_item['id'][6:] episode_thumb = episode_item.img['src'] episode_name = episode_item.span.string episode_plot = episode_item.find(id='viddesc_' + url).string show_name = episode_item.find(id='vidtitle_' + url).string u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title': episode_name, 'plot': episode_plot, 'tvshowtitle': show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels) _common.set_view('episodes')
def add_videos(url=_common.args.url): episode_data = _connection.getURL(url) episode_tree = BeautifulSoup(episode_data) episode_subs = episode_tree.find(class_='group-b') try: try: finalsubs = episode_subs.find(class_='video-list').find_all( 'tr', class_=True) except: try: finalsubs = episode_subs.find(id='vid_mod_1').find_all( itemscope=True) except: finalsubs = tree.find(id='vid_mod_1').find_all(itemscope=True) for sub in finalsubs: sub = sub.find('a') name = sub.text url = sub['href'] if BASE not in url: url = BASE + url u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_url"' _common.add_video(u, name, '', infoLabels={'title': name}) _common.set_view('episodes') except: pass
def rootlist(): root_data = _connection.getURL(SHOWS) root_tree = BeautifulSoup(root_data, 'html.parser', parse_only=SoupStrainer('div', id='azshows')) root_menu = root_tree.find_all('a') for root_item in root_menu: root_name = root_item.text.replace('Season', '').strip() season_url = root_item['href'].replace('series.jhtml', 'video.jhtml?sort=descend') mode = 'show_subcats' if BASE not in season_url: season_url = BASE + season_url if root_name in blacklist: continue elif '/shows/events' in season_url: continue docontinue = False for series_name, choosen in multiseason: if series_name in root_name: if choosen is not root_name: docontinue = True elif choosen == root_name: root_name = series_name mode = 'seasons' if docontinue is True: continue if '(' in root_name: root_name = root_name.split('(')[0].strip() _common.add_show(root_name, SITE, mode, season_url) _common.set_view('tvshows')
def show_subcats(url=_common.args.url): show_data = _connection.getURL(url) show_tree = BeautifulSoup(show_data, 'html.parser', parse_only=SoupStrainer('div', class_='group-a')) subs = show_tree.find_all('a') for sub in subs: name = sub.string url = sub['href'] if BASE not in url: url = BASE + url if name is 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="' + SITE + '"' 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.add_directory(name, SITE, 'add_videos', url) _common.set_view('seasons')
def seasons(season_url = _common.args.url): base_url = season_url season_dict = OrderedDict({}) if 'the-tonight-show' in season_url: add_show_thetonightshow(season_url) return has_episodes = False video_url = season_url + '/video' episode_url = season_url for season_url in (episode_url, video_url): season_data = _connection.getURL(season_url) season_tree = BeautifulSoup(season_data, 'html.parser') season_menu = season_tree.find_all('div', class_ = 'nbc_mpx_carousel') for season in season_menu: try: season_title = season.h2.text.strip() season_title = re.sub(' +',' ', season_title) season_id = season['id'] season_node = season_id.split('_')[-1] if season_title not in season_dict.keys(): season_dict[season_title] = EPISODES % season_node if 'full episodes' == season_title.lower() or 'Season' in season_title: has_episodes = True except: pass if not has_episodes: _common.add_directory('Full Episodes', SITE, 'episodes', base_url + '/episodes') for season_title in season_dict: season_url = season_dict[season_title] _common.add_directory(season_title, SITE, 'episodes', season_url) _common.set_view('seasons')
def episodes(episode_url = _common.args.url): episode_id, type = episode_url.split('#') episode_start = 0 episode_count = 200 while episode_start < episode_count: episode_data = cove.videos.filter(fields = 'associated_images,mediafiles', filter_program = episode_id, order_by = '-airdate', filter_availability_status = 'Available', limit_start = episode_start, filter_type = type) episode_menu = episode_data['results'] episode_count = episode_data['count'] episode_stop = episode_data['stop'] del episode_data for episode_item in episode_menu: infoLabels={} if episode_item['mediafiles']: url = str(episode_item['tp_media_object_id']) episode_name = episode_item['title'] episode_plot = episode_item['long_description'] episode_airdate = _common.format_date(episode_item['airdate'], '%Y-%m-%d %H:%M:%S', '%d.%m.%Y') episode_duration = int(episode_item['mediafiles'][0]['length_mseconds'] / 1000) episode_thumb = episode_item['associated_images'][0]['url'] for episode_thumbs in episode_item['associated_images']: if episode_thumbs['type']['eeid'] == 'iPad-Large': episode_thumb = episode_thumbs['url'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'durationinseconds' : episode_duration, 'plot' : episode_plot, 'premiered' : episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) episode_start = episode_stop _common.set_view('episodes')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(VIDEOLIST % episode_url.split('#')[0]) episode_menu = simplejson.loads(episode_data)['videos'] for episode_item in episode_menu: if int(episode_item['fullep']) == int(episode_url.split('#')[1]): show_name = episode_item['series_name'] url = episode_item['guid'] episode_duration = int(episode_item['duration_secs'])/60 episode_plot = episode_item['description_long'] episode_name = episode_item['title'] season_number = int(episode_item['season']) episode_thumb = episode_item['large_thumbnail'].replace('media.cwtv.com', 'pdl.warnerbros.com') try: episode_number = int(episode_item['episode'][len(str(season_number)):]) except: episode_number = None try: episode_airdate = _common.format_date(episode_item['airdate'],'%Y-%b-%d', '%d.%m.%Y') except: episode_airdate = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'duration' : episode_duration, 'season' : season_number, 'episode' : episode_number, 'plot' : episode_plot, 'premiered' : episode_airdate, 'tvshowtitle': show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def seasons(SITE, BRANDID): xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL) season_url = _common.args.url season_menu = [] season_numbers = [] clip_numbers = [] season_url2 = VIDEOLIST % BRANDID + '001/-1/' + season_url + '/-1/-1/-1/-1' season_data = _connection.getURL(season_url2) season_data2 = simplejson.loads(season_data)['videos'] season_count = int(season_data2['@count']) if season_count > 1: season_menu = season_data2['video'] elif season_count == 1: season_menu.append(dict(season_data2['video'])) for season_item in season_menu: if int(season_item['@accesslevel']) == 0: if season_item['@type'] == 'lf': try: if season_item['season']['@id'] not in season_numbers: season_numbers.append(season_item['season']['@id']) season_name = 'Season ' + season_item['season']['@id'] season_url3 = VIDEOLIST % BRANDID + '001/' + season_item['@type'] + '/' + season_url + '/' + season_item['season']['@id'] + '/-1/-1/-1' _common.add_directory(season_name, SITE, 'episodes', season_url3) except: pass elif season_item['@type'] == 'sf': try: if season_item['season']['@id'] not in clip_numbers: clip_numbers.append(season_item['season']['@id']) season_name = 'Season Clips ' + season_item['season']['@id'] season_url4 = VIDEOLIST % BRANDID + '001/' + season_item['@type'] + '/' + season_url + '/' + season_item['season']['@id'] + '/-1/-1/-1' _common.add_directory(season_name, SITE, 'episodes', season_url4) except: pass _common.set_view('seasons')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url, header = {'X-Forwarded-For' : '12.13.14.15'}) episode_menu = simplejson.loads(episode_data)['results'] for episode_item in episode_menu: try: show_name = episode_item['seriesTitle'] except: show_name = '' episode_name = episode_item['title'] url = 'http://legacy.nick.com/videos/clip/%s.html' url = url % episode_item['urlKey'] episode_plot = episode_item['description'] image = episode_item['images'][0]['assets'][0]['path'] episode_thumb = 'http://nick.com'+image try: episode_duration = _common.format_seconds(episode_item['duration']) except: episode_duration = -1 u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title' : episode_name, 'plot' : episode_plot, 'durationinseconds' : episode_duration, 'tvshowtitle' : show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities') _common.set_view('episodes')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url) episode_menu = simplejson.loads(episode_data)['entries'] for i, episode_item in enumerate(episode_menu): url = episode_item['media$content'][0]['plfile$url'] episode_duration = int(episode_item['media$content'][0]['plfile$duration']) episode_plot = episode_item['description'] episode_airdate = _common.format_date(epoch = episode_item['pubDate']/1000) episode_name = episode_item['title'] try: season_number = int(episode_item['pl' + str(i + 1) + '$season'][0]) except: season_number = -1 try: episode_number = int(episode_item['pl' + str(i + 1) + '$episode'][0]) except: episode_number = -1 try: episode_thumb = episode_item['plmedia$defaultThumbnailUrl'] except: episode_thumb = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'durationinseconds' : episode_duration, 'season' : season_number, 'episode' : episode_number, 'plot' : episode_plot, 'premiered' : episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url) episode_menu = simplejson.loads(episode_data.replace('}{', '},{'))['results'] for episode_item in episode_menu: show_name = _common.args.name url = episode_item['videoURL'] episode_duration = int(episode_item['length']/60) episode_plot = episode_item['shortDescription'] episode_airdate = _common.format_date(episode_item['airdate'],'%Y-%m-%d', '%d.%m.%Y') episode_name = episode_item['name'] try: season_number = episode_item['season'] except: season_number = None try: episode_number = episode_item['episode'] except: episode_number = None try: episode_thumb = episode_item['videoStillURL'] except: episode_thumb = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'duration' : episode_duration, 'season' : season_number, 'episode' : episode_number, 'plot' : episode_plot, 'premiered' : episode_airdate, 'tvshowtitle': show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url, header = {'X-Forwarded-For' : '12.13.14.15'}) episode_tree = BeautifulSoup(episode_data) episode_menu = episode_tree.find_all('article') for episode_item in episode_menu: try: show_name = episode_item.find('p', class_ = 'show-name').text except: show_name = '' episode_name = episode_item.find('p', class_ = 'short-title').text url = BASE + episode_item.find('a')['href'] episode_plot = _common.replace_signs(episode_item.find('p', class_ = 'description').text) try: episode_thumb = episode_item.find('img', class_ = 'thumbnail')['src'] except: episode_thumb = None try: episode_duration = _common.format_seconds(episode_item.find('span', class_ = 'duration').text.replace('Duration:', '')) except: episode_duration = -1 u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title' : episode_name, 'plot' : episode_plot, 'durationinseconds' : episode_duration, 'tvshowtitle' : show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities') _common.set_view('episodes')
def seasons(show_url = _common.args.url): """ Load the items for a show. This can be "Full Epiodes" and "Clips", or something based on the data. Southpark has a different site structure, so this is redirected to a different function. Some pages have a manifest Javascript object that contains JSON feeds to all episodes. Other pages do not have this. This function tries to find if the show home page has such a feed. If so, only data from the feed is used. If the home page does not have the feed, try to find the URL for the full episodes and the clips pages. For each of these pages the script tries to load the manifest feed. If this cannot be found, add items based on the HTML page. A consequence of this is that some shows can have mixed results: full episides pages does not have a manifest, but clips does. This can lead to duplication of container items. Many shows seem to contain a feed for full episodes, but this feed is empty """ if 'South Park' in _common.args.name: add_items_from_southpark(show_url) else: triforceManifestFeed = _get_manifest(show_url) if triforceManifestFeed: add_items_from_manifestfile(triforceManifestFeed, show_url) else: full_episodes_url = get_full_episodes_url(show_url) clips_url = get_clips_url(show_url) if full_episodes_url: triforceManifestFeed = _get_manifest(full_episodes_url) if triforceManifestFeed: add_items_from_manifestfile(triforceManifestFeed, full_episodes_url) else: _common.add_directory('Full Episodes', SITE, 'episodes', full_episodes_url) if clips_url: triforceManifestFeed = _get_manifest(clips_url) if triforceManifestFeed: add_items_from_manifestfile(triforceManifestFeed, clips_url) else: _common.add_directory('Full Episodes', SITE, 'episodes', clips_url) _common.set_view('seasons')
def rootlist(): root_data = _connection.getURL(SHOWS) root_tree = BeautifulSoup(root_data, 'html.parser', parse_only = SoupStrainer('div', id = 'inner')) root_menu = root_tree.find_all('div', class_ = 'alpha-group') for root_tree2 in root_menu: for root_item in root_tree2.find_all('a'): root_name = root_item.text.replace('Season','').strip() season_url = root_item['href'].replace('series.jhtml','video.jhtml?sort=descend') mode = 'show_subcats' if BASE not in season_url: season_url = BASE + season_url if root_name in blacklist: continue elif '/shows/events' in season_url: continue docontinue = False for series_name, choosen in multiseason: if series_name in root_name: if choosen is not root_name: docontinue = True elif choosen == root_name: root_name = series_name mode = 'seasons' if docontinue is True: continue if '(' in root_name: root_name = root_name.split('(')[0].strip() _common.add_show(root_name, SITE, mode, season_url) _common.set_view('tvshows')
def seasons(collection_ids = _common.args.url): for collection_id in collection_ids.split(','): if ',' not in collection_ids: season_url = SEASONSEPISODES else: season_url = SEASONSEPISODESEXTRA season_data = _connection.getURL(season_url % collection_id) season_tree = BeautifulSoup(season_data, 'html.parser') episode_count = int(season_tree.episodes['totalitems']) if episode_count > 0: if ',' not in collection_ids: display = 'Episodes' else: display = 'Episodes - %s' % season_tree.episode['collectiontitle'] _common.add_directory(display, SITE, 'episodes', FULLEPISODES % collection_id) for collection_id in collection_ids.split(','): if ',' not in collection_ids: seasonclips_url = SEASONSCLIPS else: seasonclips_url = SEASONSCLIPSEXTRA season_data2 = _connection.getURL(seasonclips_url % collection_id) season_tree2 = BeautifulSoup(season_data2, 'html.parser') episode_count = int(season_tree2.episodes['totalitems']) if episode_count > 0: if ',' not in collection_ids: display = 'Clips' else: display = 'Clips - %s' % season_tree2.episode['collectiontitle'] _common.add_directory(display, SITE, 'episodes', CLIPS % collection_id) _common.set_view('seasons')
def season_options(url = _common.args.url): _common.add_directory('All Videos', SITE,'add_videos',url) _common.add_directory('Full Episodes', SITE, 'add_videos', url + 'fulleps') _common.add_directory('Bonus Clips', SITE, 'add_videos', url + 'bonusclips') _common.add_directory('After Shows', SITE, 'add_videos', url + 'aftershows') _common.add_directory('Sneak Peeks', SITE, 'add_videos', url + 'sneakpeeks') _common.set_view('seasons')
def add_videos(url=_common.args.url): episode_data = _connection.getURL(url) episode_tree = BeautifulSoup(episode_data) episode_subs = episode_tree.find(class_ = 'group-b') try: try: finalsubs = episode_subs.find(class_ = 'video-list').find_all('tr', class_ = True) except: try: finalsubs = episode_subs.find(id = 'vid_mod_1').find_all(itemscope = True) except: finalsubs = tree.find(id = 'vid_mod_1').find_all(itemscope = True) for sub in finalsubs: sub = sub.find('a') name = sub.text url = sub['href'] if BASE not in url: url = BASE + url u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_url"' _common.add_video(u, name, '', infoLabels = {'title' : name}, quality_mode = 'list_qualities') _common.set_view('episodes') except: pass
def episodes(): episode_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' } episode_data = _connection.getURL(VIDEOURL, episode_values) episode_tree = simplejson.loads(episode_data)['html']['date'] episode_menu = BeautifulSoup(episode_tree).find_all('li') for episode_item in episode_menu: episode_name = episode_item.a.img['title'] episode_plot = episode_item.a.img['alt'].replace('/n', ' ') episode_thumb = episode_item.a.img['src'] url = episode_item.a['href'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = {'title': episode_name, 'plot': episode_plot} _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels) _common.set_view('episodes')
def episodes(episode_url=_common.args.url): episode_data = _connection.getURL(episode_url, forwardheader='12.13.14.15') episode_tree = BeautifulSoup(episode_data) episode_menu = episode_tree.find_all('article') for episode_item in episode_menu: show_name = episode_item.find('p', class_='show-name').text episode_name = episode_item.find('p', class_='short-title').text url = BASE + episode_item.find('a')['href'] episode_plot = _common.replace_signs( episode_item.find('p', class_='description').text) try: episode_thumb = episode_item.find('img', class_='thumbnail')['src'] except: episode_thumb = None try: duration = episode_item.find('span', class_='duration').text.replace( 'Duration:', '') except: duration = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title': episode_name, 'plot': episode_plot, 'tvshowtitle': show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels) _common.set_view('episodes')
def seasons(season_url=_common.args.url): season_data = _connection.getURL(FULLEPISODES % season_url + '&start=0&rows=1', forwardheader='12.13.14.15') try: season_menu = int( BeautifulSoup(season_data).find( 'section', class_='video-content-list')['data-numfound']) except: season_menu = 0 if season_menu > 0: season_url2 = FULLEPISODES % season_url + '&start=0&rows=' + str( season_menu) _common.add_directory('Full Episodes', SITE, 'episodes', season_url2) season_data2 = _connection.getURL(CLIPS % season_url + '&start=0&rows=1', forwardheader='12.13.14.15') try: season_menu2 = int( BeautifulSoup(season_data2).find( 'section', class_='video-content-list')['data-numfound']) except: season_menu2 = 0 if season_menu2 > 0: season_url3 = CLIPS % season_url + '&start=0&rows=' + str(season_menu2) _common.add_directory('Clips', SITE, 'episodes', season_url3) _common.set_view('seasons')
def rootlist(): root_start = 0 root_count = 200 root_check = [] root_menu = simplejson.loads(_connection.getURL(SHOWS, header = {'X-Requested-With' : 'XMLHttpRequest'})) for root_item in root_menu.itervalues(): for root_item in root_item: root_check.append(root_item['title']) while root_start < root_count: root_data = cove.programs.filter(fields = 'mediafiles', order_by = 'title', limit_start = root_start) root_menu = root_data['results'] root_count = root_data['count'] root_stop = root_data['stop'] del root_data for root_item2 in root_menu: if root_item2['website'] is None: root_website = '' else: root_website = root_item2['website'] if (root_item2['title'] in root_check) and ('pbskids.org' not in root_website): root_name = _common.smart_utf8(root_item2['title']) season_url = re.compile('/cove/v1/programs/(.*?)/').findall(root_item2['resource_uri'])[0] _common.add_show(root_name, SITE, 'seasons', season_url) root_start = root_stop _common.set_view('tvshows')
def episodes(SITE): episode_menu = [] episode_data = _connection.getURL(_common.args.url) episode_data2 = simplejson.loads(episode_data)['videos'] episode_count = int(episode_data2['@count']) if episode_count > 1: episode_menu = episode_data2['video'] elif episode_count == 1: episode_menu.append(dict(episode_data2['video'])) for episode_item in episode_menu: if int(episode_item['@accesslevel']) == 0: highest_height = -1 episode_name = episode_item['title'] episode_duration = int(episode_item['duration']['$']) / 1000 season_number = episode_item['season']['@id'] episode_id = episode_item['@id'] episode_type = episode_item['@type'] try: episode_description = _common.replace_signs(episode_item['longdescription']) except: episode_description = _common.replace_signs(episode_item['description']) try: episode_airdate = episode_item['airdates']['airdate'].rsplit(' ',1)[0] episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y') except: try: episode_airdate = episode_item['airdates']['airdate'][0].rsplit(' ',1)[0] episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y') except: episode_airdate = -1 try: episode_number = episode_item['number'] except: episode_number = -1 try: for episode_picture in episode_item['thumbnails']['thumbnail']: try: picture_height = int(episode_picture['@width']) except: if episode_picture['@type'] == 'source-16x9': picture_height = 720 else: picture_height = 0 if picture_height > highest_height: highest_height = picture_height episode_thumb = episode_picture['$'] except: episode_thumb = episode_item['thumbnails']['thumbnail']['$'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(episode_id) + '#' + urllib.quote_plus(episode_type) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={'title' : episode_name, 'plot' : episode_description, 'premiered' : episode_airdate, 'durationinseconds' : episode_duration, 'episode' : episode_number, 'season' : season_number } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def seasons(collection_ids=_common.args.url): for collection_id in collection_ids.split(","): if "," not in collection_ids: season_url = SEASONSEPISODES else: season_url = SEASONSEPISODESEXTRA season_data = _connection.getURL(season_url % collection_id) print BeautifulSoup(season_data, "html.parser").episodes season_tree = BeautifulSoup(season_data, "html.parser") episode_count = int(season_tree.episodes["totalitems"]) if episode_count > 0: if "," not in collection_ids: display = "Episodes" else: display = "Episodes - %s" % season_tree.episode["collectiontitle"] _common.add_directory(display, SITE, "episodes", FULLEPISODES % collection_id) for collection_id in collection_ids.split(","): if "," not in collection_ids: seasonclips_url = SEASONSCLIPS else: seasonclips_url = SEASONSCLIPSEXTRA season_data2 = _connection.getURL(seasonclips_url % collection_id) season_tree2 = BeautifulSoup(season_data2, "html.parser") print BeautifulSoup(season_data2, "html.parser").episodes episode_count = int(season_tree2.episodes["totalitems"]) if episode_count > 0: if "," not in collection_ids: display = "Clips" else: display = "Clips - %s" % season_tree2.episode["collectiontitle"] _common.add_directory(display, SITE, "episodes", CLIPS % collection_id) _common.set_view("seasons")
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url) episode_tree = BeautifulSoup(episode_data, 'html5lib') episode_menu = episode_tree.find('ul', id = 'browse_results').find_all('li', recursive = False) for episode_item in episode_menu: episode_name = episode_item.a['title'] episode_thumb = episode_item.img['src'] episode_plot = episode_item.find('div', class_ = 'browse_result_description').string.strip() show_name = _common.args.name url = BASE + episode_item.a['href'] try: episode_duration = episode_item.find('span', class_ = 'duration').string.strip('()') except: episode_duration = 0 try: episode_airdate = episode_item.find('p', class_ = 'browse_result_sale grid-visible').string.replace('Available: ','') episode_airdate = _common.format_date(episode_airdate, inputFormat = '%b %d, %Y') except: episode_airdate = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'duration' : episode_duration, 'plot' : episode_plot, 'premiered' : episode_airdate, 'tvshowtitle': show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url) episode_menu = simplejson.loads(episode_data) for episode_item in episode_menu['items']: if episode_item['videos']: url = episode_item['guid'] episode_name = episode_item['title'] episode_plot = episode_item['description'] episode_airdate = _common.format_date(episode_item['airdate'], '%Y-%m-%d %H:%M:%S', '%d.%m.%Y') episode_duration = int(episode_item['videos'].itervalues().next()['length']) / 1000 try: episode_thumb = episode_item['images']['kids-mezzannine-16x9']['url'] except: try: episode_thumb = episode_item['images']['kids-mezzannine-4x3']['url'] except: episode_thumb = episode_item['images']['mezzanine']['url'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'durationinseconds' : episode_duration, 'plot' : episode_plot, 'premiered' : episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def seasons(season_urls = _common.args.url): root_url = season_urls if season_urls[-1:] == '/': season_urls = season_urls + 'video' else: season_urls = season_urls + '/video' season_data = _connection.getURL(season_urls) show_id = re.compile('video.settings.show_id = (.*);').findall(season_data)[0] section_ids = re.compile('video.section_ids = \[(.*)\];').findall(season_data)[0] if section_ids: for section in section_ids.split(','): season_url = SEASONS % section season_data2 = _connection.getURL(season_url) try: season_title = simplejson.loads(season_data2)['result']['title'] _common.add_directory(season_title, SITE, 'episodes', FULLEPISODES % (section, show_id)) except: pass else: show_tree = BeautifulSoup(season_data, 'html5lib') season_menu = show_tree.find_all(attrs = {'name' : 'season'}) for season_item in season_menu: season_url = root_url + 'season/%s/videos/episodes' % season_item['value'] _common.add_directory('Season ' + season_item['value'], SITE, 'episodesClassic', season_url) for season_item in season_menu: season_url = root_url + 'season/%s/videos/clips' % season_item['value'] _common.add_directory('Clips Season ' + season_item['value'], SITE, 'episodesClassic', season_url) _common.set_view('seasons')
def seasons(season_url = _common.args.url): season_data = _connection.getURL(season_url) season_tree = BeautifulSoup(season_data, 'html.parser', parse_only = SoupStrainer('div')) season_menu = season_tree.find('a', text = re.compile('full episodes', re.IGNORECASE)) season_menu2 = season_tree.find('a', href = re.compile('(?<!stand-up)/(video|clips)')) if season_menu is not None: season_url2 = season_menu['href'] if 'http' not in season_url2: season_url2 = season_url + season_url2 _common.add_directory('Full Episodes', SITE, 'episodes', season_url2) elif 'episode' in season_url: if 'South Park' in _common.args.name: seasons = BeautifulSoup(season_data, 'html5lib').find_all('a',class_='seasonbtn') if seasons: for season in seasons: try: display = 'Season %s' %str(int(season.string)) except: display = 'Special %s' %season.string _common.add_directory(display, SITE, 'episodes', season['href'] ) else: _common.add_directory('Full Episodes', SITE, 'episodes', season_url) print season_url if season_menu2 is not None: season_url3 = season_menu2['href'] if 'http' not in season_url3: season_url3 = season_url + season_url3 _common.add_directory('Clips', SITE, 'episodes', season_url3) _common.set_view('seasons')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = simplejson.loads(root_data)['shows']['show'] for root_item in root_menu: fullepisodes = 0 clips = 0 if (int(root_item['clips']['count']['@total']) + int(root_item['fullepisodes']['count']['@total'])) > 0: if int(root_item['clips']['count']['@total']) > 0: try: if int(root_item['clips']['count']['video']['@accesslevel']) == 0: clips = int(root_item['clips']['count']['video']['$']) except: if int(root_item['clips']['count']['video'][0]['@accesslevel']) == 0: clips = int(root_item['clips']['count']['video'][0]['$']) if int(root_item['fullepisodes']['count']['@total']) > 0: try: if int(root_item['fullepisodes']['count']['video']['@accesslevel']) == 0: fullepisodes = int(root_item['fullepisodes']['count']['video']['$']) except: if int(root_item['fullepisodes']['count']['video'][0]['@accesslevel']) == 0: fullepisodes = int(root_item['fullepisodes']['count']['video'][0]['$']) if (fullepisodes + clips) > 0: root_name = root_item['title'] season_url = root_item['@id'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def seasons(season_url = _common.args.url): xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL) season_menu = [] season_numbers = [] clip_numbers = [] season_url2 = VIDEOLIST + '-1/' + season_url + '/-1/-1/-1/-1' season_data = _connection.getURL(season_url2) season_data2 = simplejson.loads(season_data)['videos'] season_count = int(season_data2['@count']) if season_count > 1: season_menu = season_data2['video'] elif season_count == 1: season_menu.append(dict(season_data2['video'])) for season_item in season_menu: if int(season_item['@accesslevel']) == 0: if season_item['@type'] == 'lf': try: if season_item['season']['@id'] not in season_numbers: season_numbers.append(season_item['season']['@id']) season_name = 'Season ' + season_item['season']['@id'] season_url3 = VIDEOLIST + season_item['@type'] + '/' + season_url + '/' + season_item['season']['@id'] + '/-1/-1/-1' _common.add_directory(season_name, SITE, 'episodes', season_url3) except: pass elif season_item['@type'] == 'sf': try: if season_item['season']['@id'] not in clip_numbers: clip_numbers.append(season_item['season']['@id']) season_name = 'Season Clips ' + season_item['season']['@id'] season_url4 = VIDEOLIST + season_item['@type'] + '/' + season_url + '/' + season_item['season']['@id'] + '/-1/-1/-1' _common.add_directory(season_name, SITE, 'episodes', season_url4) except: pass _common.set_view('seasons')
def episodes(episode_url = _common.args.url): episode_data = _connection.getURL(episode_url) episode_tree = BeautifulSoup(episode_data, 'html5lib') episode_menu = episode_tree.find_all('div', id = re.compile('video_*')) for episode_item in episode_menu: show_name = episode_item.strong.string episode_name = _common.replace_signs(episode_item.a.img['title'].replace(show_name,'')) episode_thumb = episode_item.a.img['src'].rsplit('_',1)[0] + '_640x360.jpg' episode_plot = _common.replace_signs(episode_item.find_all('p')[1].text) url = BASE + episode_item.a['href'] try: seasonEpisode = episode_item.find('span', class_ = 'type').string seasonSplit = seasonEpisode.split(': Ep. ') season_number = int(seasonSplit[0].replace('Season', '').strip()) episodeSplit = seasonSplit[1].split(' ') episode_number = int(episodeSplit[0]) episode_duration = episodeSplit[1].replace('(', '').replace(')', '').strip() except: season_number = None episode_number = None episode_duration = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'duration' : episode_duration, 'season' : season_number, 'episode' : episode_number, 'plot' : episode_plot, 'tvshowtitle' : show_name } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def episodes(episode_url = _common.args.url): episode_menu = [] episode_data = _connection.getURL(episode_url) episode_data2 = simplejson.loads(episode_data)['videos'] episode_count = int(episode_data2['@count']) if episode_count > 1: episode_menu = episode_data2['video'] elif episode_count == 1: episode_menu.append(dict(episode_data2['video'])) for episode_item in episode_menu: if int(episode_item['@accesslevel']) == 0: highest_height = -1 episode_name = episode_item['title'] episode_duration = int(episode_item['duration']['$'])/60000 season_number = episode_item['season']['@id'] episode_id = episode_item['@id'] episode_type = episode_item['@type'] try: episode_description = _common.replace_signs(episode_item['longdescription']) except: episode_description = _common.replace_signs(episode_item['description']) try: episode_airdate = episode_item['airdates']['airdate'].rsplit(' ',1)[0] episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y') except: try: episode_airdate = episode_item['airdates']['airdate'][0].rsplit(' ',1)[0] episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y') except: episode_airdate = None try: episode_number = episode_item['number'] except: episode_number = None try: for episode_picture in episode_item['thumbnails']['thumbnail']: try: picture_height = int(episode_picture['@width']) except: if episode_picture['@type'] == 'source-16x9': picture_height = 720 else: picture_height = 0 if picture_height > highest_height: highest_height = picture_height episode_thumb = episode_picture['$'] except: episode_thumb = episode_item['thumbnails']['thumbnail']['$'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(episode_id) + '#' + urllib.quote_plus(episode_type) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={'title' : episode_name, 'plot' : episode_description, 'premiered' : episode_airdate, 'duration' : episode_duration, 'episode' : episode_number, 'season' : season_number } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) _common.set_view('episodes')
def seasons(season_urls=_common.args.url): for season_url in season_urls.split(','): season_data = _connection.getURL(FULLEPISODES % urllib.quote_plus(season_url) + '&range=0-1') try: season_menu = int(simplejson.loads(season_data)['totalResults']) except: season_menu = 0 if season_menu > 0: season_url2 = FULLEPISODES % urllib.quote_plus( season_url) + '&range=0-' + str(season_menu) _common.add_directory('Full Episodes', SITE, 'episodes', season_url2) season_data2 = _connection.getURL(CLIPS % urllib.quote_plus(season_url) + '&range=0-1') try: season_menu2 = int(simplejson.loads(season_data2)['totalResults']) except: season_menu2 = 0 if season_menu2 > 0: season_url3 = CLIPS % urllib.quote_plus( season_url) + '&range=0-' + str(season_menu2) if ',' in season_urls: _common.add_directory('Clips %s' % season_url, SITE, 'episodes', season_url3) else: _common.add_directory('Clips', SITE, 'episodes', season_url3) _common.set_view('seasons')
def episodes(episode_url=_common.args.url): episode_data = _connection.getURL(episode_url) episode_tree = BeautifulSoup(episode_data) episode_carousel = episode_tree.find_all('div', class_='tab-wrap') for episode in episode_carousel: if _common.args.name == episode.h2.text: episode_menu = episode.find_all('li', class_='result-item') for episode_item in episode_menu: episode_name = episode_item.img['title'] episode_thumb = episode_item.img['src'] episode_exp_id = episode_item.a['data-video'] episode_plot = episode_item.find( 'p', class_='description').text.strip() url = episode_url u = sys.argv[0] u += '?url="' + urllib.quote_plus( url) + '#' + urllib.quote_plus(episode_exp_id) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = {'title': episode_name, 'plot': episode_plot} _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels) _common.set_view('episodes')
def seasons(collection_ids = _common.args.url): for collection_id in collection_ids.split(','): if ',' not in collection_ids: season_url = SEASONSEPISODES else: season_url = SEASONSEPISODESEXTRA season_data = _connection.getURL(season_url % collection_id) print BeautifulSoup(season_data, 'html.parser').episodes season_tree = BeautifulSoup(season_data, 'html.parser') episode_count = int(season_tree.episodes['totalitems']) if episode_count > 0: if ',' not in collection_ids: display = 'Episodes' else: display = 'Episodes - %s' % season_tree.episode['collectiontitle'] _common.add_directory(display, SITE, 'episodes', FULLEPISODES % collection_id) for collection_id in collection_ids.split(','): if ',' not in collection_ids: seasonclips_url = SEASONSCLIPS else: seasonclips_url = SEASONSCLIPSEXTRA season_data2 = _connection.getURL(seasonclips_url % collection_id) season_tree2 = BeautifulSoup(season_data2, 'html.parser') print BeautifulSoup(season_data2, 'html.parser').episodes episode_count = int(season_tree2.episodes['totalitems']) if episode_count > 0: if ',' not in collection_ids: display = 'Clips' else: display = 'Clips - %s' % season_tree2.episode['collectiontitle'] _common.add_directory(display, SITE, 'episodes', CLIPS % collection_id) _common.set_view('seasons')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = simplejson.loads(root_data)['shows'] for root_item in root_menu: root_name = root_item['show']['title'] season_url = BASE + root_item['show']['path'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = BeautifulSoup(root_data).find('select', id = 'rb-video-browser-show').find_all('option', title = True) for root_item in root_menu: root_name = root_item.text season_url = root_item['value'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = simplejson.loads(root_data)['entries'] for root_item in root_menu: root_name = root_item['title'] season_url = root_item['plcategory$fullTitle'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = simplejson.loads(root_data)['shows'] for root_item in root_menu: if root_item['external_link'] == '': root_name = root_item['title'] _common.add_show(root_name, SITE, 'seasons', root_name) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = BeautifulSoup(root_data, 'html5lib').find_all(href = re.compile('/shows/')) for root_item in root_menu: root_name = root_item['title'] season_url = BASE + root_item['href'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = simplejson.loads(root_data)['shows'] for root_item in root_menu: if root_item['external_link'] == '': root_name = root_item['title'] _common.add_show(root_name, SITE, 'seasons', root_name) _common.set_view('tvshows')
def seasons(season_url=_common.args.url): season_data = _connection.getURL(season_url) season_tree = BeautifulSoup(season_data) season_menu = season_tree.find_all('div', class_='tab-wrap') for season_item in season_menu: season_name = season_item.h2.text _common.add_directory(season_name, SITE, 'episodes', season_url) _common.set_view('seasons')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = BeautifulSoup(root_data, 'html5lib').find_all('li') for root_item in root_menu: root_name = root_item.a.string.rsplit(' ', 1)[0].strip() season_url = BASE + root_item.a['href'] + '?limit=100' _common.add_show(root_name, SITE, 'episodes', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = BeautifulSoup(root_data, 'html5lib').find_all('li') for root_item in root_menu: root_name = root_item.a.string.rsplit(' ',1)[0].strip() season_url = BASE + root_item.a['href'] + '?limit=100' _common.add_show(root_name, SITE, 'episodes', season_url) _common.set_view('tvshows')
def rootlist(): show_data = _connection.getURL(SHOWS) show_tree = BeautifulSoup(show_data, 'html5lib') show_menu = show_tree.find('div', id='shows-list').find_all('a') for show_item in show_menu: show_name = _common.smart_utf8(show_item.text) _common.add_show(show_name, SITE, 'seasons', show_item['href']) _common.set_view('tvshows')
def seasons(season_url = _common.args.url): season_data = _connection.getURL(season_url) season_tree = BeautifulSoup(season_data, 'html.parser') season_menu = season_tree.find_all('div', class_ = 'tab-wrap') for season_item in season_menu: season_name = season_item.h2.text _common.add_directory(season_name, SITE, 'episodes', season_url) _common.set_view('seasons')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = simplejson.loads(root_data)['entries'] for root_item in root_menu: root_name = root_item['title'] season_url = root_item['plcategory$fullTitle'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def episodes(episode_url=_common.args.url): episode_data = _connection.getURL(episode_url) episode_json = simplejson.loads(episode_data)['result'] episode_menu = episode_json['data'] title = episode_json['title'] for episode_item in episode_menu: url_att = episode_item['url_att'] type = episode_item['type'] if (episode_item['url_in_window'] ) or url_att or title != 'Full Episodes' or not episode_item[ 'url_amazon']: videourl = episode_item['streaming_url'] url = BASE + episode_item['url'] episode_duration = int( _common.format_seconds(episode_item['duration'])) episode_airdate = _common.format_date(episode_item['airdate'], '%m/%d/%y') episode_name = episode_item['label'] if episode_name == '': episode_name = episode_item['title'] try: season_number = int(episode_item['season_number']) except: season_number = -1 try: episode_number = int(episode_item['episode_number']) except: episode_number = -1 try: episode_thumb = episode_item['thumb']['large'] except: episode_thumb = None if url_att: episode_pid = url_att.split('c___')[1] episode_plot = '' else: episode_plot, episode_pid = lookup_meta(url) if episode_pid is not None: u = sys.argv[0] u += '?url="' + urllib.quote_plus(episode_pid) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title': episode_name, 'durationinseconds': episode_duration, 'season': season_number, 'episode': episode_number, 'plot': episode_plot, 'premiered': episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels, quality_mode='list_qualities') else: pass _common.set_view('episodes')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = BeautifulSoup(root_data, 'html5lib').find_all(href=re.compile('/shows/')) for root_item in root_menu: root_name = root_item['title'] season_url = BASE + root_item['href'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_menu = BeautifulSoup(root_data).find( 'select', id='rb-video-browser-show').find_all('option', title=True) for root_item in root_menu: root_name = root_item.text season_url = root_item['value'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_tree = BeautifulSoup(root_data) root_menu = root_tree.footer.find_all('li', class_='views-row') for root_item in root_menu: root_name = _common.smart_utf8(root_item.text.strip()) season_url = root_item.a['href'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def episodes(episode_url = _common.args.url): try: season_number = episode_url.split('#')[1] except: season_number = -1 episode_url = episode_url.split('#')[0] episode_data = _connection.getURL(episode_url) episode_menu = simplejson.loads(episode_data)['FolderList'][0]['PlaylistList'][0] for episode_item in episode_menu['MediaList']: if episode_item['Season'] == season_number or season_number == -1: ''' THX to foreverguest ''' path_pattern = re.compile('http:\\/\\/.+?\/(.+?)_[a-zA-Z0-9]+') pattern_url = episode_item['Thumbnail_Wide'] path = path_pattern.findall(pattern_url) if not path and episode_item['ClosedCaptionFiles']: path = path_pattern.findall(episode_item['ClosedCaptionFiles'][0]['Path']) if not path: continue video_url = BASE + path[0] + '_' episode_duration = int(episode_item['DurationInSeconds']) episode_name = episode_item['Title'] episode_plot = episode_item['Description'] try: episode_airdate = _common.format_date(episode_item['ReleaseDate'], '%m/%d/%Y') except: episode_airdate = None try: episode_number = int(episode_item['Episode']) except: episode_number = -1 try: episode_thumb = episode_item['Thumbnail_854x480'] except: episode_thumb = None try: episode_caption = episode_item['ClosedCaptionFiles'][0]['Path'] except: episode_caption = '' episode_MPAA = episode_item['Rating'] episode_genre = episode_item['Genre'] episode_showtitle = episode_item['ParentChannelName'] video_url = video_url + '#' + episode_caption u = sys.argv[0] u += '?url="' + urllib.quote_plus(video_url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels={ 'title' : episode_name, 'durationinseconds' : episode_duration, 'season' : season_number, 'episode' : episode_number, 'plot' : episode_plot, 'premiered' : episode_airdate, 'MPAA' : episode_MPAA, 'Genre' : episode_genre, 'TVShowTitle' : episode_showtitle} _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities') _common.set_view('episodes')
def episodes(episode_url=_common.args.url): if 'the-tonight-show' in episode_url: if 'Clips' in _common.args.name: add_videos_thetonightshow(episode_url, 'segment') else: add_videos_thetonightshow(episode_url, 'episode') return episode_data = _connection.getURL(episode_url) episode_json = simplejson.loads(episode_data) episode_menu = episode_json['entries'] for episode_item in episode_menu: pid = episode_item['media$content'][0]['plfile$releases'][0][ 'plrelease$pid'] url = SMIL % pid try: episode_duration = int(episode_item['plfile$duration'].replace( ' min', '')) * 60 except: episode_duration = -1 episode_plot = HTMLParser.HTMLParser().unescape( episode_item['description']) epoch = int(episode_item['pubDate']) / 1000 episode_airdate = _common.format_date(epoch=epoch) episode_name = HTMLParser.HTMLParser().unescape(episode_item['title']) show_title = episode_item['showShortName'] try: season_number = int(episode_item['pl1$seasonNumber']) except: season_number = -1 try: episode_number = int(episode_item['pl1$episodeNumber']) except: episode_number = -1 try: episode_thumb = episode_item['plmedia$defaultThumbnailUrl']['big'] except: episode_thumb = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title': episode_name, 'durationinseconds': episode_duration, 'season': season_number, 'episode': episode_number, 'plot': episode_plot, 'premiered': episode_airdate, 'TVShowTitle': show_title } _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels, quality_mode='list_qualities') _common.set_view('episodes')
def add_videos_thetonightshow(url, type_, page=1, added_episodes=[]): this_url = (TONIGHT_SHOW_FEED % url) + '&offset=' + str((page - 1) * 10) root_data = _connection.getURL(this_url) data = simplejson.loads(root_data) for video in data['content']: if video['type'] == type_: if type_ == 'episode': episode_name = video['name'] episode_id = video['episodeNumber'] else: episode_name = video['title'] episode_id = video['id'] if episode_id in added_episodes: continue added_episodes.append(episode_id) pid = video['videos'][0]['mpxPublicId'] episode_url = SMIL % pid episode_plot = BeautifulSoup( video['description']['value']).p.string try: episode_airdate = _common.format_date(video['airDate'][:-6], '%Y-%m-%dT%H:%M:%S', '%d.%m.%Y') except: episode_airdate = -1 try: season_number = int(video['season']) except: season_number = -1 try: episode_number = int(video['episodeNumber']) except: episode_number = -1 try: episode_thumb = video['images'][0]['bitImageSmall'] except: episode_thumb = None u = sys.argv[0] u += '?url="' + urllib.quote_plus(episode_url) + '"' u += '&mode="' + SITE + '"' u += '&sitemode="play_video"' infoLabels = { 'title': episode_name, 'season': season_number, 'episode': episode_number, 'plot': episode_plot, 'premiered': episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels, quality_mode='list_qualities') if page < int(_addoncompat.get_setting('maxpages')): add_videos_thetonightshow(url, type_, page + 1, added_episodes) _common.set_view('episodes')
def rootlist(): root_data = _connection.getURL(SHOWS) root_tree = BeautifulSoup(root_data, 'html.parser') root_menu = root_tree.find_all('option') root_menu.pop(0) for root_item in root_menu: root_name = root_item.string season_url = root_item['value'] _common.add_show(root_name, SITE, 'seasons', season_url) _common.set_view('tvshows')
def rootlist(): root_data = _connection.getURL(SHOWS) root_tree = BeautifulSoup(root_data, 'html5lib').find('ul', id='channelCarousel_ul') root_menu = root_tree.find_all('a') for root_item in root_menu: root_name = root_item.img['alt'].strip() season_url = root_item['title'] _common.add_show(root_name, SITE, 'episodes', season_url) _common.set_view('tvshows')