def getHoster(self, sHosterFileName): if sHosterFileName != '': source = [urlresolver.HostedMediaFile(url=sHosterFileName)] if (urlresolver.filter_source_list(source)): return source[0].get_host() # media_id is in this case only a dummy source = [urlresolver.HostedMediaFile(host=sHosterFileName, media_id='ABC123XYZ')] if (urlresolver.filter_source_list(source)): return source[0].get_host() return False
def VIDEOLINKS(url,types): returl = url r = re.findall(r'player/.+?/(.+?)/',url) for name in r: html = GETHTML(url) if "<br><b class='error'>Movie have been removed</b>" in html: xbmc.executebuiltin("XBMC.Notification([B][COLOR red]Movie Removed[/B][/COLOR],TubePlus says Movie Removed,10000,'')") return if types == 'latesttv' or types =='season2': types ='tvshow' if ':' in name: name = name.split(':') name = name[0] else: name = name meta = grab. _cache_lookup_by_name(str(types), str(name),year='') infoLabels = {'cover_url': meta['cover_url']} r = re.compile(r'class="(o.+?)">.+?javascript:show\(\'(.+?)\'\,\'.+?\'\,\s\'(.+?)\'\)\;.+?<b>(.+?)said work',re.M|re.DOTALL).findall(html) sources =[] for status, file_id, hoster, said in r: percentage = said.replace('%','') if int(percentage) in range(0,25): title = '[COLOR yellow]'+hoster+'[/COLOR][COLOR red] '+status+' '+said+'[/COLOR]' if int(percentage) in range(25,50): title = '[COLOR yellow]'+hoster+' '+status+' '+said+'[/COLOR]' if int(percentage) in range(50,75): title = '[COLOR yellow]'+hoster+'[/COLOR][COLOR orange] '+status+' '+said+'[/COLOR]' if int(percentage) in range(75,101): title = '[COLOR yellow]'+hoster+'[/COLOR][COLOR green] '+status+' '+said+'[/COLOR]' source = urlresolver.HostedMediaFile(host=hoster, media_id=file_id, title=title) sources.append(source) urlresolver.filter_source_list(sources) source = urlresolver.choose_source(sources) try: if source: stream_url = source.resolve() else: stream_url = '' liz=xbmcgui.ListItem(name, iconImage='',thumbnailImage=infoLabels['cover_url']) liz.setInfo('Video', {'Title': name} ) liz.setProperty("IsPlayable","true") xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream_url,isFolder=False,listitem=liz) xbmc.Player().play(stream_url,liz) except: xbmc.executebuiltin("XBMC.Notification([COLOR red]Connection Error[/COLOR]Please check status of hoster @real-debrid,10000,''") if ADDON.getSetting('firstrun') == 'false' and ADDON.getSetting('hoster_warning') == 'true': dialog = xbmcgui.Dialog() dialog.ok("[I]TubePLUS by www.xbmchub.com[/I]", "[I][B]DO NOT FORGET TO CHANGE THE REAL-DEBRID[/I][/B]","[I][B]PRIORITY TO 105, THAT WILL REDUCE THE ERRORS![/I][/B]","") dialog.ok("[I]TubePLUS by www.xbmchub.com[/I]", "[I]You can dissable this popup in the addon settings[/I]","[I]Reminder about REAL-DEBRID priority[/I]") return VIDEOLINKS(returl,types)
def LISTHOSTERS(name,url): html = GETHTML(url) if html == None: return main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','') r = re.findall(r'class="td_cols"><a target=\'_blank\'.+?href=\'(.+?)\'>',html, re.M|re.DOTALL) try: t = re.findall(r'rel="nofollow">((?!.*\.rar).*)</a>', html, re.I) r = r+t except: pass if len(r) == 0: addon.show_ok_dialog(['No Playable Streams Found,','It Might Be That They Are Still Being Uploaded,', 'Or They Are Unstreamable Archive Files'],'MashUP: TV-Release') return sources = [] for url in r: media = urlresolver.HostedMediaFile(url=url) sources.append(media) sources = urlresolver.filter_source_list(sources) r = re.findall(r'\'url\': \'(.+?)\', \'host\': \'(.+?)\'', str(sources), re.M) for url, host in r: r = re.findall(r'(.+?)\.',host) if 'www.real-debrid.com' in host: host = re.findall(r'//(.+?)/', url) host = host[0].replace('www.','') host = host.rpartition('.') host = host[0] else: host = r[0] main.addDown2(name+"[COLOR blue] :"+host.upper()+"[/COLOR]",url,1005,art+'/hosts/'+host+'.png',art+'/hosts/'+host+'.png')
def ListHosts(url, name, imdb): originalName = name sources = [] html = BeautifulSoup(net(userAgent).http_GET(url).content).prettify soup = BeautifulSoup(str(html)) a = soup.findAll("span", {"class": "embed-out-link"}) pattern = 'http://adf.ly/\d+/(.+?)\"' r = re.findall(pattern, str(a), re.I) for url in r: if 'www' in url: url = 'http://'+url else: url = 'http://www.'+url hosted_media = urlresolver.HostedMediaFile(url=url, title=name) sources.append(hosted_media) sources = urlresolver.filter_source_list(sources) r = re.findall(r'url\'\: \'(.+?)\', \'host', str(sources)) totalitems = len(r) hoster = [] if 'DM' in imdb: for url in r: name = re.findall(r'\.(\w+)\.', url)[0].title() hoster.append(url) return (hoster) else: for url in r: name = re.findall(r'\.(\w+)\.', url)[0].title() addDir(100, url, None, originalName, name, '', totalitems, imdb+'HL', True, None)
def VIDEOLINKS(url,types): r = re.findall(r'player/.+?/(.+?)/',url) for name in r: html = GETHTML(url) if "<br><b class='error'>Movie have been removed</b>" in html: xbmc.executebuiltin("XBMC.Notification([B][COLOR red]Movie Removed[/B][/COLOR],TubePlus says Movie Removed,10000,'')") GA("None","MOVIE REMOVED: "+name+':'+info) return if types == 'latesttv' or types =='season2': types ='tvshow' if ':' in name: name = name.split(':') name = name[0] else: name = name meta = grab. _cache_lookup_by_name(str(types), str(name),year='') infoLabels = {'cover_url': meta['cover_url']} r = re.compile(r'class="(o.+?)">.+?javascript:show\(\'(.+?)\'\,\'.+?\'\,\s\'(.+?)\'\)\;.+?<b>(.+?)said work',re.M|re.DOTALL).findall(html) sources =[] for status, file_id, hoster, said in r: percentage = said.replace('%','') if int(percentage) in range(0,25): title = '[COLOR yellow]'+hoster+'[/COLOR][COLOR red] '+status+' '+said+'[/COLOR]' if int(percentage) in range(26,50): title = '[COLOR yellow]'+hoster+' '+status+' '+said+'[/COLOR]' if int(percentage) in range(51,75): title = '[COLOR yellow]'+hoster+'[/COLOR][COLOR orange] '+status+' '+said+'[/COLOR]' if int(percentage) in range(76,101): title = '[COLOR yellow]'+hoster+'[/COLOR][COLOR green] '+status+' '+said+'[/COLOR]' source = urlresolver.HostedMediaFile(host=hoster, media_id=file_id, title=title) sources.append(source) urlresolver.filter_source_list(sources) source = urlresolver.choose_source(sources) try: if source: stream_url = source.resolve() else: stream_url = '' liz=xbmcgui.ListItem(name, iconImage='',thumbnailImage=infoLabels['cover_url']) liz.setInfo('Video', {'Title': name} ) liz.setProperty("IsPlayable","true") xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream_url,isFolder=False,listitem=liz) xbmc.Player().play(stream_url,liz) except: xbmc.executebuiltin("XBMC.Notification([COLOR red]Connection Error[/COLOR]Please check status of hoster @real-debrid,10000,''") GA("None","HOSTER ERROR: "+hoster) dialog = xbmcgui.Dialog() dialog.ok("[I]TubePLUS by www.xbmchub.com[/I]", "[I]To get the best results from this addon, Set the [/I]","[I][B]Real-Debrid[/B] priority setting to [B]105[/B] in the [/I]","[I]resolver settings.[/I]") GA("None","WATCHING MEDIA")
def FIND_VIDEO_STREAMS(url): print url name2 = name html = GET_HTML(url,'') if '<strong>IMDb Ratings & Details:' in html: r = re.findall(r'<strong>IMDb Ratings & Details:.+?data-title="(.+?)" data-style=',html) imdb_no = r[0] print 'IMDB: '+imdb_no sources = [] try: if '<strong>Watch Full Movie on' in html: r = re.findall(r'<p><strong>Movie Plot: </strong>(.+?)<script type="text/javascript" src=',html,re.M|re.DOTALL) r = re.findall(r'<a href="(.+?)" target="_blank">Click Here To Watch Full Movie (.+?)</a>',str(r)) print r for url, part in r: domain = re.findall(r'//(.+?)/',url) hoster = domain[0]+': '+part.replace('\\xc2\\xa0',' ') print hoster source = urlresolver.HostedMediaFile(url=url, title=hoster) sources.append(source) except: pass try: r = re.findall(r'Watch Full.+?</strong>.+?<p><a href="(.+?)" target=',html,re.M|re.DOTALL) print r for url in r: hoster = re.findall(r'//(.+?)/',url) source = urlresolver.HostedMediaFile(url=url, title=hoster[0]) sources.append(source) except: pass urlresolver.filter_source_list(sources) source = urlresolver.choose_source(sources) try: if source: stream_url = source.resolve() else: stream_url = '' liz=xbmcgui.ListItem(name, iconImage='',thumbnailImage='') liz.setInfo('Video', {'Title': name2} ) liz.setProperty("IsPlayable","true") xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream_url,isFolder=False,listitem=liz) xbmc.Player().play(stream_url) except: pass
def getHoster(self, sHosterFileName): """ interfaces urlresolver to find supported hoster.. :param sHosterFileName: str, link to media as scraped from page :returns str: the hostname of the hoster or False """ if sHosterFileName != '': source = [HostedMediaFile(url=sHosterFileName)] valid_sources = urlresolver.filter_source_list(source) if valid_sources: return valid_sources[0].get_host() return False
def parse(self, content): """ Parses the request return :param content: Content from Request """ rtn = [] matches = self.re.findall(content) # Try urlresolver import urlresolver sources = [urlresolver.HostedMediaFile(url=url) for url in matches] for source in urlresolver.filter_source_list(sources): web_url = source.resolve() if web_url: rtn.append(web_url) if rtn: return rtn # Try own approach for url in matches: mp = VideoScanner(url) # Try to add video url try: rtn.extend(mp.run()) except NoContentProvided: continue # Just Loop until a mp4/flv/avi has been found if rtn: break if not rtn and "/upcoming.jpg" in content: raise UpcomingEpisode() return rtn
def choose_source(sources): """ Given a list of :class:`HostedMediaFile` representing web pages that are thought to be associated with media content this function checks which are playable and if there are more than one it pops up a dialog box displaying the choices. Example:: sources = [HostedMediaFile(url='http://youtu.be/VIDEOID', title='Youtube [verified] (20 views)'), HostedMediaFile(url='http://putlocker.com/file/VIDEOID', title='Putlocker (3 views)')] source = urlresolver.choose_source(sources) if source: stream_url = source.resolve() addon.resolve_url(stream_url) else: addon.resolve_url(False) Args: sources (list): A list of :class:`HostedMediaFile` representing web pages that are thought to be associated with media content. Returns: The chosen :class:`HostedMediaFile` or ``False`` if the dialog is cancelled or none of the :class:`HostedMediaFile` are resolvable. """ #get rid of sources with no resolver plugin try: sources = filter_source_list(sources) except HTTPError as e: error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') common.addon.log_error('got http error %d fetching %s' % (e.code, e.url)) common.addon.show_small_popup(title='Error', msg='Http error: %s' % e, delay=8000, image=error_logo) return False except Exception as e: error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') common.addon.log('**** Exception occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]STAGEVU[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return False #show dialog to choose source if len(sources) > 1: dialog = xbmcgui.Dialog() titles = [] for source in sources: titles.append(source.title) index = dialog.select('Choose your stream', titles) if index > -1: return sources[index] else: return False #only one playable source so just play it elif len(sources) == 1: return sources[0] #no playable sources available else: common.addon.log_error('no playable streams found') return False