def _list_videos(html): pattern_video = '<li class="teaser">(.*?)</li>' pattern_video_data = 'href="(.*?)".*?<img src="(.*?)".*?"title">(.*?)<' videos = re.findall(pattern_video, html, re.DOTALL) parser = HTMLParser() for video in videos: if '<div class="video_indicator">' in video: try: video_data = re.findall(pattern_video_data, video, re.DOTALL)[0] except: continue url, thumb, title = video_data title = parser.unescape(title.decode('utf-8', 'ignore')) thumb = parser.unescape(thumb.decode('utf-8', 'ignore')) gui.add_video(title, thumb, {'f': 'play', 'url': url}) # now look for more videos button index_more_videos = html.find( '<div class="more jsb_ jsb_MoreTeasersButton" data-jsb="') if index_more_videos != -1: url_more_videos = html[index_more_videos + 55:html.find('"', index_more_videos + 55)] if url_more_videos.startswith('url='): url_more_videos = url_more_videos[4:] gui.add_folder('[B]Nächste Seite[/B]', None, { 'f': 'more', 'url': url_more_videos })
def list_seasons(html): index_seasons = html.find('<select class="select jsb_ jsb_Select"') if index_seasons != -1: seasons_block = html[index_seasons:html.find('</select>', index_seasons)] seasons = re.findall('<option .*?value="(.*?)">(.*?)</option>', seasons_block, re.DOTALL) for url, title in seasons: gui.add_folder(title, None, {'f': 'videos', 'url': url}) return True return False
def list_seasons(html): index_seasons = html.find('<select class="select jsb_ jsb_Select"') if index_seasons != -1: seasons_block = html[index_seasons:html.find('</select>', index_seasons )] seasons = re.findall('<option .*?value="(.*?)">(.*?)</option>', seasons_block, re.DOTALL) for url, title in seasons: gui.add_folder(title, None, {'f': 'videos', 'url': url}) return True return False
def list_clusters(): url = __URL_MAIN_PAGE + '/mediathek/' response = requests.get(url, headers=__HEADERS) html = response.read() pattern = '<li class="program">.*?href="(.*?)".*?<img src="(.*?)".*?title="(.*?)".*?</li>' clusters = re.findall(pattern, html, re.DOTALL) parser = HTMLParser() for url, thumb, title in clusters: title = parser.unescape(title.decode('utf-8', 'ignore')) gui.add_folder(title, thumb, {'f': 'cluster', 'url': url}) gui.end_listing()
def _list_videos(html): pattern_video = '<li class="teaser">(.*?)</li>' pattern_video_data = 'href="(.*?)".*?<img src="(.*?)".*?"title">(.*?)<' videos = re.findall(pattern_video, html, re.DOTALL) parser = HTMLParser() for video in videos: if '<div class="video_indicator">' in video: try: video_data = re.findall(pattern_video_data, video, re.DOTALL)[0] except: continue url, thumb, title = video_data title = parser.unescape(title.decode('utf-8', 'ignore')) thumb = parser.unescape(thumb.decode('utf-8', 'ignore')) gui.add_video(title, thumb, {'f': 'play', 'url': url}) # now look for more videos button index_more_videos = html.find('<div class="more jsb_ jsb_MoreTeasersButton" data-jsb="') if index_more_videos != -1: url_more_videos = html[index_more_videos + 55:html.find('"', index_more_videos + 55)] if url_more_videos.startswith('url='): url_more_videos = url_more_videos[4:] gui.add_folder('[B]Nächste Seite[/B]', None, {'f': 'more', 'url': url_more_videos})
def index(): import thumbnails live_caption = api.get_number_livestreams() if live_caption: live_caption = '[B]Live (%s)[/B]' % live_caption else: live_caption = 'Live (%s)' % live_caption gui.add_folder( live_caption, thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/livestreams.json', 'reliveOnly': False }, 'aktuelle Live Streams') gui.add_folder( 'Neueste Videos', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos.json', 'reliveOnly': False }, 'Liste der neuesten Videos - über alle Kategorien') gui.add_folder( 'Neueste Videos - [COLOR blue] Re-Live only [/COLOR]', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos.json', 'reliveOnly': True }, 'Liste der neuesten Re-Lives - über alle Kategorien') gui.add_folder( 'Fussball', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/fussball.json', 'reliveOnly': False }, 'Liste der neuesten Fussball-Videos') gui.add_folder( 'US-Sports', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/us-sport.json', 'reliveOnly': False }, 'Liste der neuesten US-Sport-Videos (NBA, NFL, NHL)') gui.add_folder( 'US-Sports: [COLOR blue] Re-Live only [/COLOR]', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/us-sport.json', 'reliveOnly': True }, 'Liste der neuesten Re-Live-Videos des US-Sports auf ran.de (NBA, NFL, NHL)' ) gui.add_folder( 'Tennis', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/tennis.json', 'reliveOnly': False }, 'Liste der neuesten Tennis-Videos') gui.add_folder( 'Handball', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/handball.json', 'reliveOnly': False }, 'Liste der neuesten Handball-Videos') gui.add_folder( 'Boxen', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/boxen.json', 'reliveOnly': False }, 'Liste der neuesten Box-Videos') gui.add_folder( 'Darts', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/darts.json', 'reliveOnly': False }, 'Liste der neuesten Darts-Videos') gui.add_folder( 'eSports', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/esport.json', 'reliveOnly': False }, 'Liste der neuesten eSports-Videos') gui.add_folder( 'DTM', thumbnails.THUMB_MAIN, { 'f': 'videos', 'resource': '/ran-mega/mobile/v1/videos/dtm.json', 'reliveOnly': False }, 'Liste der neuesten Videos der Deutschen Tourenwagen Meisterschaft (DTM)' ) gui.end_listing()
def index(): import thumbnails live_caption = api.get_number_livestreams() if live_caption: live_caption = '[B]Live (%s)[/B]' % live_caption else: live_caption = 'Live (%s)' % live_caption gui.add_folder(live_caption, thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/livestreams.json'}) gui.add_folder('Neueste Videos', thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/videos.json'}) gui.add_folder('Fussball', thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/videos/fussball.json'}) gui.add_folder('Tennis', thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/videos/tennis.json'}) gui.add_folder('NFL', thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/videos/us-sport.json'}) gui.add_folder('Boxen', thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/videos/boxen.json'}) gui.add_folder('Golf', thumbnails.THUMB_MAIN, {'f': 'videos', 'resource': '/ran-app/v1/videos/golf.json'}) gui.end_listing()