def add_clips(episode_tree): try: episode_menu = episode_tree.find_all('div', class_ = 'block') for episode_item in episode_menu: episode_name = _common.replace_signs(episode_item.find('h3').a.text) episode_plot = _common.replace_signs(episode_item.find('p', class_ = False).text) episode_thumb = episode_item.find('img')['src'].split('?')[0] url = episode_item.find('div', class_ = 'thumb_area').a['href'] try: episode_airdate = episode_item.find('div', class_ = 'details').contents[0].split(' ', 1)[1].strip() episode_airdate = _common.format_date(episode_airdate, '%B %d, %Y', '%d.%m.%Y') except: episode_airdate = -1 try: episode_duration = _common.format_seconds(episode_item.find('h3').small.text.replace(')', '').replace('(', '')) 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, 'durationinseconds' : episode_duration, 'plot' : episode_plot, 'premiered' : episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels) except: pass
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 add_fullepisodes(episode_tree, season_number = -1): try: episode_menu = episode_tree.find_all('div', class_ = 'episode_guide') for episode_item in episode_menu: episode_name = _common.replace_signs(episode_item.find('img')['title']) episode_airdate = _common.format_date(episode_item.find('p', class_ = 'aired_available').contents[1].strip(), '%m/%d/%Y', '%d.%m.%Y') episode_plot = _common.replace_signs(episode_item.find('p', class_ = False).text) episode_thumb = episode_item.find('img')['src'].split('?')[0] url = episode_item.find('div', class_ = 'thumb_image').a['href'] try: episode_number = int(episode_item.find('a', class_ = 'title').contents[1].split('Episode ' + season_number)[1]) except: try: episode_number = int(url.split('-0')[1]) except: episode_number = -1 if season_number == -1: season_number = int(url.split('-')[-3]) u = sys.argv[0] u += '?url="' + urllib.quote_plus(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') except: pass
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 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 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 add_fullepisodes(episode_tree, season_number=-1): try: episode_menu = episode_tree.find_all('div', class_='episode_guide') for episode_item in episode_menu: episode_name = _common.replace_signs( episode_item.find('img')['title']) episode_airdate = _common.format_date( episode_item.find( 'p', class_='aired_available').contents[1].strip(), '%m/%d/%Y', '%d.%m.%Y') episode_plot = _common.replace_signs( episode_item.find('p', class_=False).text) episode_thumb = episode_item.find('img')['src'].split('?')[0] url = episode_item.find('div', class_='thumb_image').a['href'] try: episode_number = int( episode_item.find( 'a', class_='title').contents[1].split('Episode ' + season_number)[1]) except: try: episode_number = int(url.split('-0')[1]) except: episode_number = -1 if season_number == -1: season_number = int(url.split('-')[-3]) u = sys.argv[0] u += '?url="' + urllib.quote_plus(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') except: pass
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 add_clips(episode_tree): try: episode_menu = episode_tree.find_all('div', class_='block') for episode_item in episode_menu: episode_name = _common.replace_signs( episode_item.find('h3').a.text) episode_plot = _common.replace_signs( episode_item.find('p', class_=False).text) episode_thumb = episode_item.find('img')['src'].split('?')[0] url = episode_item.find('div', class_='thumb_area').a['href'] try: episode_airdate = episode_item.find( 'div', class_='details').contents[0].split(' ', 1)[1].strip() episode_airdate = _common.format_date(episode_airdate, '%B %d, %Y', '%d.%m.%Y') except: episode_airdate = -1 try: episode_duration = _common.format_seconds( episode_item.find('h3').small.text.replace(')', '').replace( '(', '')) 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, 'durationinseconds': episode_duration, 'plot': episode_plot, 'premiered': episode_airdate } _common.add_video(u, episode_name, episode_thumb, infoLabels=infoLabels) except: pass
def masterlist(): master_dict = {} master_db = [] for master_url in (CLIPS, SHOWS): master_data = _connection.getURL(master_url) master_tree = BeautifulSoup(master_data, 'html5lib').find('div', id = 'show-directory') master_menu = master_tree.find_all('li') for master_item in master_menu: master_name = _common.replace_signs(clean_title(master_item.a.text)) season_url = BASE + master_item.a['href'] master_dict[master_name] = season_url for master_name, season_url in master_dict.iteritems(): master_db.append((master_name, SITE, 'episodes', season_url)) return master_db
def masterlist(): master_dict = {} master_db = [] for master_url in (CLIPS, SHOWS): master_data = _connection.getURL(master_url) master_tree = BeautifulSoup(master_data, 'html5lib').find('div', id='show-directory') master_menu = master_tree.find_all('li') for master_item in master_menu: master_name = _common.replace_signs(clean_title( master_item.a.text)) season_url = BASE + master_item.a['href'] master_dict[master_name] = season_url for master_name, season_url in master_dict.iteritems(): master_db.append((master_name, SITE, 'episodes', season_url)) return master_db