def _create_video_stream_item(videoLink, inx=''): videoHostingInfo = SnapVideo().findVideoHostingInfo(videoLink) label = videoHostingInfo.get_name() + inx item = xbmcgui.ListItem(label=label, iconImage=videoHostingInfo.get_icon(), thumbnailImage=videoHostingInfo.get_icon()) item.setProperty( 'streamLink', 'plugin://plugin.video.tvondesizonexl/?videoLink=' + urllib.quote_plus(videoLink)) return item
def __prepareVideoLink__(video_link): logging.getLogger().debug(video_link) video_url = video_link['videoLink'] video_source = video_link['videoSource'] new_video_url = None if re.search('videos.desihome.info', video_url, flags=re.I): new_video_url = __parseDesiHomeUrl__(video_url) if new_video_url is None: video_id = re.compile('(id|url|v|si|sim)=(.+?)/').findall(video_url + '/')[0][1] if re.search('dm(\d*).php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('dailymotion', video_source, flags=re.I)): new_video_url = 'http://www.dailymotion.com/video/' + video_id + '_' elif re.search('(flash.php|fp.php|wire.php|pw.php)', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and video_id.isdigit() and re.search('flash', video_source, flags=re.I)): new_video_url = 'http://config.playwire.com/videos/v2/' + video_id + '/player.json' elif re.search('(youtube|u|yt)(\d*).php', video_url, flags=re.I): new_video_url = 'http://www.youtube.com/watch?v=' + video_id + '&' elif re.search('mega.co.nz', video_url, flags=re.I): new_video_url = video_url elif re.search('(put|pl).php', video_url, flags=re.I): new_video_url = 'http://www.putlocker.com/file/' + video_id elif re.search('(cl|cloud).php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('cloudy', video_source, flags=re.I)): new_video_url = 'https://www.cloudy.ec/embed.php?id=' + str(video_id) elif re.search('videohut.php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('video hut', video_source, flags=re.I)): new_video_url = 'http://www.videohut.to/embed.php?id=' + video_id elif re.search('letwatch.php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('letwatch', video_source, flags=re.I)): new_video_url = 'http://letwatch.us/embed-' + str(video_id) + '-620x496.html' elif re.search('videosky.php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('video sky', video_source, flags=re.I)): new_video_url = 'http://www.videosky.to/embed.php?id=' + str(video_id) elif re.search('(weed.php|vw.php)', video_url, flags=re.I): new_video_url = 'http://www.videoweed.es/file/' + video_id elif re.search('(sockshare.com|sock.com)', video_url, flags=re.I): new_video_url = video_url elif re.search('divxstage.php', video_url, flags=re.I): new_video_url = 'divxstage.eu/video/' + video_id + '&' elif re.search('(hostingbulk|hb).php', video_url, flags=re.I): new_video_url = 'hostingbulk.com/' + video_id + '&' elif re.search('(movshare|ms).php', video_url, flags=re.I): new_video_url = 'movshare.net/video/' + video_id + '&' elif re.search('mz.php', video_url, flags=re.I): new_video_url = 'movzap.com/' + video_id + '&' elif re.search('nv.php', video_url, flags=re.I): new_video_url = 'nowvideo.ch/embed.php?v=' + video_id + '&' elif re.search('nm.php', video_url, flags=re.I): new_video_url = 'novamov.com/video/' + video_id + '&' elif re.search('tune.php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and video_id.isdigit() and re.search('tune.pk', video_source, flags=re.I)): new_video_url = 'tune.pk/play/' + video_id + '&' elif re.search('vshare.php', video_url, flags=re.I): new_video_url = 'http://vshare.io/d/' + video_id + '&' elif re.search('vidto.php', video_url, flags=re.I): new_video_url = 'http://vidto.me/' + video_id + '.html' elif re.search('videotanker.php', video_url, flags=re.I) or ((re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and video_id.isdigit() and re.search('video tanker', video_source, flags=re.I)): new_video_url = 'http://videotanker.co/player/embed_player.php?vid=' + video_id + '&' video_hosting_info = SnapVideo().findVideoHostingInfo(new_video_url) video_link['videoLink'] = new_video_url video_link['videoSourceImg'] = video_hosting_info.get_icon() video_link['videoSourceName'] = video_hosting_info.get_name()
def _retrieve_video_links_(req_attrib, modelMap): modelMap['channel-name'] = req_attrib['channel-name'] modelMap['tv-show-name'] = req_attrib['tv-show-name'] modelMap['episode-name'] = req_attrib['episode-name'] video_source_id = 1 video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = False list_items = [] contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'left-div'}) soup = HttpClient().get_beautiful_soup(url=req_attrib['episode-url'], parseOnlyThese=contentDiv) # soup = BeautifulSoup.BeautifulSoup(HttpClient().get_html_content(url=req_attrib['episode-url'])).findAll('blockquote', {'class':re.compile(r'\bpostcontent\b')})[0] centerTag = soup.findNext('center') logging.getLogger().debug(centerTag) prevChild = '' prevAFont = None isHD = 'false' videoSource = '' for child in soup.findChildren(): if child.name == 'span': if len(video_playlist_items) > 0: list_items.append(__preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items, modelMap, isHD)) logging.getLogger().debug(videoSource) videoSource = child.getText() if(re.search('720p', videoSource, re.I)): isHD = 'true' else: isHD = 'false' if video_source_img is not None: video_source_id = video_source_id + 1 video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = False elif not ignoreAllLinks and child.name == 'a': if (str(child['href']) != 'https://www.facebook.com/iamdesirulez'): video_part_index = video_part_index + 1 video_link = {} video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText() video_link['videoLink'] = str(child['href']) video_link['videoSource'] = videoSource try: try: __prepareVideoLink__(video_link) except Exception, e: logging.getLogger().exception(e) video_hosting_info = SnapVideo().findVideoHostingInfo(video_link['videoLink']) if video_hosting_info is None or video_hosting_info.get_name() == 'UrlResolver by t0mm0': raise video_link['videoSourceImg'] = video_hosting_info.get_icon() video_link['videoSourceName'] = video_hosting_info.get_name() video_playlist_items.append(video_link) video_source_img = video_link['videoSourceImg'] video_source_name = video_link['videoSourceName'] item = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img) item.setProperty('videoLink', video_link['videoLink']) item.setProperty('videoTitle', video_link['videoTitle']) item.setProperty('videoSourceName', video_source_name) item.setProperty('isContinuousPlayItem', 'false') list_items.append(item) prevAFont = child.findChild('font') except: logging.getLogger().error('Unable to recognize a source = ' + str(video_link['videoLink'])) video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = True prevAFont = None
def _create_video_stream_item(videoLink, inx=''): videoHostingInfo = SnapVideo().findVideoHostingInfo(videoLink) label = videoHostingInfo.get_name() + inx item = xbmcgui.ListItem(label=label, iconImage=videoHostingInfo.get_icon(), thumbnailImage=videoHostingInfo.get_icon()) item.setProperty('streamLink', 'plugin://plugin.video.tvondesizonexl/?videoLink=' + urllib.quote_plus(videoLink)) return item
def __prepareVideoLink__(video_link): logging.getLogger().debug(video_link) video_url = video_link['videoLink'] video_source = video_link['videoSource'] new_video_url = None if re.search('videos.desihome.info', video_url, flags=re.I): new_video_url = __parseDesiHomeUrl__(video_url) if new_video_url is None: video_id = re.compile('(id|url|v|si|sim)=(.+?)/').findall(video_url + '/')[0][1] if re.search('dm(\d*).php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('dailymotion', video_source, flags=re.I)): new_video_url = 'http://www.dailymotion.com/video/' + video_id + '_' elif re.search( '(flash.php|fp.php|wire.php|pw.php)', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and video_id.isdigit() and re.search('flash', video_source, flags=re.I)): new_video_url = 'http://config.playwire.com/videos/v2/' + video_id + '/player.json' elif re.search('(youtube|u|yt)(\d*).php', video_url, flags=re.I): new_video_url = 'http://www.youtube.com/watch?v=' + video_id + '&' elif re.search('mega.co.nz', video_url, flags=re.I): new_video_url = video_url elif re.search('(put|pl).php', video_url, flags=re.I): new_video_url = 'http://www.putlocker.com/file/' + video_id elif re.search('(cl|cloud).php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('cloudy', video_source, flags=re.I)): new_video_url = 'https://www.cloudy.ec/embed.php?id=' + str( video_id) elif re.search('videohut.php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('video hut', video_source, flags=re.I)): new_video_url = 'http://www.videohut.to/embed.php?id=' + video_id elif re.search('letwatch.php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('letwatch', video_source, flags=re.I)): new_video_url = 'http://letwatch.us/embed-' + str( video_id) + '-620x496.html' elif re.search('videosky.php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and not video_id.isdigit() and re.search('video sky', video_source, flags=re.I)): new_video_url = 'http://www.videosky.to/embed.php?id=' + str( video_id) elif re.search('(weed.php|vw.php)', video_url, flags=re.I): new_video_url = 'http://www.videoweed.es/file/' + video_id elif re.search('(sockshare.com|sock.com)', video_url, flags=re.I): new_video_url = video_url elif re.search('divxstage.php', video_url, flags=re.I): new_video_url = 'divxstage.eu/video/' + video_id + '&' elif re.search('(hostingbulk|hb).php', video_url, flags=re.I): new_video_url = 'hostingbulk.com/' + video_id + '&' elif re.search('(movshare|ms).php', video_url, flags=re.I): new_video_url = 'movshare.net/video/' + video_id + '&' elif re.search('mz.php', video_url, flags=re.I): new_video_url = 'movzap.com/' + video_id + '&' elif re.search('nv.php', video_url, flags=re.I): new_video_url = 'nowvideo.ch/embed.php?v=' + video_id + '&' elif re.search('nm.php', video_url, flags=re.I): new_video_url = 'novamov.com/video/' + video_id + '&' elif re.search('tune.php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and video_id.isdigit() and re.search('tune.pk', video_source, flags=re.I)): new_video_url = 'tune.pk/play/' + video_id + '&' elif re.search('vshare.php', video_url, flags=re.I): new_video_url = 'http://vshare.io/d/' + video_id + '&' elif re.search('vidto.php', video_url, flags=re.I): new_video_url = 'http://vidto.me/' + video_id + '.html' elif re.search('videotanker.php', video_url, flags=re.I) or ( (re.search('([a-z]*).tv/', video_url, flags=re.I) or re.search('([a-z]*).net/', video_url, flags=re.I) or re.search('([a-z]*).com/', video_url, flags=re.I) or re.search('([a-z]*).me/', video_url, flags=re.I)) and video_id.isdigit() and re.search('video tanker', video_source, flags=re.I)): new_video_url = 'http://videotanker.co/player/embed_player.php?vid=' + video_id + '&' video_hosting_info = SnapVideo().findVideoHostingInfo(new_video_url) video_link['videoLink'] = new_video_url video_link['videoSourceImg'] = video_hosting_info.get_icon() video_link['videoSourceName'] = video_hosting_info.get_name()
def _retrieve_video_links_(req_attrib, modelMap): modelMap['channel-name'] = req_attrib['channel-name'] modelMap['tv-show-name'] = req_attrib['tv-show-name'] modelMap['episode-name'] = req_attrib['episode-name'] video_source_id = 1 video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = False list_items = [] contentDiv = BeautifulSoup.SoupStrainer('div', {'id': 'left-div'}) soup = HttpClient().get_beautiful_soup(url=req_attrib['episode-url'], parseOnlyThese=contentDiv) # soup = BeautifulSoup.BeautifulSoup(HttpClient().get_html_content(url=req_attrib['episode-url'])).findAll('blockquote', {'class':re.compile(r'\bpostcontent\b')})[0] centerTag = soup.findNext('center') logging.getLogger().debug(centerTag) prevChild = '' prevAFont = None isHD = 'false' videoSource = '' for child in soup.findChildren(): if child.name == 'span': if len(video_playlist_items) > 0: list_items.append( __preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items, modelMap, isHD)) logging.getLogger().debug(videoSource) videoSource = child.getText() if (re.search('720p', videoSource, re.I)): isHD = 'true' else: isHD = 'false' if video_source_img is not None: video_source_id = video_source_id + 1 video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = False elif not ignoreAllLinks and child.name == 'a': if (str(child['href']) != 'https://www.facebook.com/iamdesirulez'): video_part_index = video_part_index + 1 video_link = {} video_link['videoTitle'] = 'Source #' + str( video_source_id) + ' | ' + 'Part #' + str( video_part_index) + ' | ' + child.getText() video_link['videoLink'] = str(child['href']) video_link['videoSource'] = videoSource try: try: __prepareVideoLink__(video_link) except Exception, e: logging.getLogger().error(e) video_hosting_info = SnapVideo().findVideoHostingInfo( video_link['videoLink']) if video_hosting_info is None or video_hosting_info.get_name( ) == 'UrlResolver by t0mm0': raise video_link[ 'videoSourceImg'] = video_hosting_info.get_icon() video_link[ 'videoSourceName'] = video_hosting_info.get_name() video_playlist_items.append(video_link) video_source_img = video_link['videoSourceImg'] video_source_name = video_link['videoSourceName'] item = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index), iconImage=video_source_img, thumbnailImage=video_source_img) item.setProperty('videoLink', video_link['videoLink']) item.setProperty('videoTitle', video_link['videoTitle']) item.setProperty('videoSourceName', video_source_name) item.setProperty('isContinuousPlayItem', 'false') list_items.append(item) prevAFont = child.findChild('font') except: logging.getLogger().error( 'Unable to recognize a source = ' + str(video_link['videoLink'])) video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = True prevAFont = None
def _retrieve_video_links_(req_attrib, modelMap): modelMap['channel-name'] = req_attrib['channel-name'] modelMap['tv-show-name'] = req_attrib['tv-show-name'] modelMap['episode-name'] = req_attrib['episode-name'] video_source_id = 1 video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = False list_items = [] soup = BeautifulSoup.BeautifulSoup(HttpClient().get_html_content(url=req_attrib['episode-url'])).findAll('blockquote', {'class':re.compile(r'\bpostcontent\b')})[0] for e in soup.findAll('br'): e.extract() # Removing the child font within font to handle where the font gets changed at the end for HQ for e in soup.find('font').findAll('font'): e.extract() logging.getLogger().debug(soup) if soup.has_key('div'): soup = soup.findChild('div', recursive=False) prevChild = '' prevAFont = None isHD = 'false' videoSource = '' for child in soup.findChildren(): if (child.name == 'img' or child.name == 'b' or (child.name == 'font' and not child.findChild('a'))): if (child.name == 'b' and prevChild == 'a') or (child.name == 'font' and child == prevAFont): continue else: if len(video_playlist_items) > 0: list_items.append(__preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items, modelMap, isHD)) logging.getLogger().debug(videoSource) videoSource = child.getText() if(re.search('720p', videoSource, re.I)): isHD = 'true' else: isHD = 'false' if video_source_img is not None: video_source_id = video_source_id + 1 video_source_img = None video_source_name = None video_part_index = 0 video_playlist_items = [] ignoreAllLinks = False elif not ignoreAllLinks and child.name == 'a' and not re.search('multi', str(child['href']), re.IGNORECASE): video_part_index = video_part_index + 1 video_link = {} video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText() video_link['videoLink'] = str(child['href']) video_link['videoSource'] = videoSource try: try: __prepareVideoLink__(video_link) except Exception, e: logging.getLogger().error(e) video_hosting_info = SnapVideo().findVideoHostingInfo(video_link['videoLink']) if video_hosting_info is None or video_hosting_info.get_name() == 'UrlResolver by t0mm0': raise video_link['videoSourceImg'] = video_hosting_info.get_icon() video_link['videoSourceName'] = video_hosting_info.get_name() video_playlist_items.append(video_link) video_source_img = video_link['videoSourceImg'] video_source_name = video_link['videoSourceName'] item = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img) item.setProperty('videoLink', video_link['videoLink']) item.setProperty('videoTitle', video_link['videoTitle']) item.setProperty('videoSourceName', video_source_name) item.setProperty('isContinuousPlayItem', 'false') list_items.append(item) prevAFont = child.findChild('font') except: