class bayfilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "bayfiles" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html=self.net.http_GET(web_url).content found = re.search(r'var vfid = (\d+);\s*var delay = (\d+);', html) vfid, delay = found.groups() response = json.loads(self.net.http_POST('http://bayfiles.com/ajax_download',{"_": wait() * 1000,"action": "startTimer","vfid": vfid}).content) common.addon.show_countdown(int(delay),'[B][COLOR orange]BAYFILES[/COLOR][/B]','') html = self.net.http_POST('http://bayfiles.com/ajax_download',{"token": response['token'],"action": "getLink","vfid": vfid}).content final_link = re.search(r"javascript:window.location.href = '([^']+)';", html) return final_link.group(1) def get_url(self, host, media_id): return 'http://%s.com/file/uMXL/%s'%(host,media_id) def get_host_and_id(self, url): r = re.match(r'http://(bayfiles).com/file/uMXL/([a-zA-Z0-9._/]+)',url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match(r'http://(bayfiles).com/file/uMXL/([a-zA-Z0-9._/]+)', url) or 'bayfiles' in host)
class TheFileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "thefile" domains = [ "thefile.me" ] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: headers = { 'Referer': web_url } html = self.net.http_GET(web_url).content # check if we have a p,ac,k,e,d source r = re.search('<script\stype=(?:"|\')text/javascript(?:"|\')>(eval\(function\(p,a,c,k,e,[dr]\)(?!.+player_ads.+).+?)</script>',html,re.DOTALL) if r: js = jsunpack.unpack(r.group(1)) r = re.search("file:\'(.+?)\'",js.replace('\\','')) if r: return r.group(1) data = {} r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value data.update({'referer': web_url}) data.update({'method_free': 'Free Download'}) data.update({'op': 'download1'}) html = self.net.http_POST(web_url, data, headers=headers).content data = {} r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value data.update({'referer': web_url}) data.update({'btn_download': 'Create Download Link'}) data.update({'op': 'download2'}) html = self.net.http_POST(web_url, data, headers=headers).content r = re.search(r'<span>\s*<a\s+href="(.+?)".*</a>\s*</span>',html) if r: return r.group(1) else: raise Exception("File Link Not Found") except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log(self.name + ': general error occurred: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]THEFILE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class EcostreamResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "ecostream" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?ecostream.tv)/(?:stream|embed)?/([0-9a-zA-Z]+).html' def get_media_url(self, host, media_id): # emulate click on button "Start Stream" (ss=1) web_url = self.get_url(host, media_id) + "?ss=1" try: html = self.net.http_POST(web_url,{'ss':'1'}).content # get vars sPattern = "var t=setTimeout\(\"lc\('([^']+)','([^']+)','([^']+)','([^']+)'\)" r = re.findall(sPattern, html) if not r: raise Exception ('Unable to resolve Ecostream link. Post var not found.') for aEntry in r: sS = str(aEntry[0]) sK = str(aEntry[1]) sT = str(aEntry[2]) sKey = str(aEntry[3]) # get name of php file web_url = 'http://www.ecostream.tv/assets/js/common.js' html = self.net.http_GET(web_url).content sPattern = "url: '([^=]+)=" r = re.search(sPattern, html) if r is None : raise Exception ('Unable to resolve Ecostream link. Name of php-file not found.') # send vars and retrieve stream url web_url = r.group(1)+'='+sS+'&k='+sK+'&t='+sT+'&key='+sKey postParams = ({'s':sS,'k':sK,'t':sT,'key':sKey}) postHeader = ({'Referer':'http://www.ecostream.tv', 'X-Requested-With':'XMLHttpRequest'}) html = self.net.http_POST(web_url, postParams,headers = postHeader).content sPattern = '<param name="flashvars" value="file=(.*?)&' r = re.search(sPattern, html) if not r: raise Exception ('Unable to resolve Ecostream link. Filelink not found.') sLinkToFile = 'http://www.ecostream.tv'+r.group(1) return urllib2.unquote(sLinkToFile) except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** Ecostream Error occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]Ecostream[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg='Exception: %s' % e)
def LISTINT3(xurl): final=[] from t0mm0.common.net import Net net = Net() ak=GetAK() xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Source Data,10000)") main.addDir('Search Peliculaspepito','movieNEW',303,art+'/search.png') if xurl=='http://www.peliculaspepito.com': i=0 while i != 450: header={'Accept':'application/json, text/javascript, */*; q=0.01','Accept-Encoding':'gzip,deflate,sdch','Accept-Language':'en-US,en;q=0.8','Cache-Control':'max-age=0', 'Connection':'keep-alive','Content-Length':'314','Content-Type':'application/x-www-form-urlencoded; charset=UTF-8','Referer':'http://www.peliculaspepito.com/peliculas/', 'X-Requested-With':'XMLHttpRequest'} post_data={'fblistado_pag':str(i),'fblistado_generos':'','fblistado_letras':'','fblistado_idiomas':'','fblistado_calidades':'','fblistado_ano_min':'','fblistado_ano_max':'' ,'fblistado_ord_tipo':'','listado_bcad':'','ak':ak,'ourl':'http://www.peliculaspepito.com/peliculas/','spfin':'buscador_Listar_Fin'} html = net.http_POST('http://www.peliculaspepito.com/ajax/buscador_catalogo',post_data,header).content html=html.replace('\\\\','') html=html.replace('\\','') final.append(html) i=i+45 else: header={'Accept':'application/json, text/javascript, */*; q=0.01','Accept-Encoding':'gzip,deflate,sdch','Accept-Language':'en-US,en;q=0.8','Cache-Control':'max-age=0', 'Connection':'keep-alive','Content-Length':'314','Content-Type':'application/x-www-form-urlencoded; charset=UTF-8','Referer':'http://www.peliculaspepito.com/peliculas/', 'X-Requested-With':'XMLHttpRequest'} post_data={'fblistado_pag':'0','fblistado_generos':'','fblistado_letras':'','fblistado_idiomas':'','fblistado_calidades':'','fblistado_ano_min':'','fblistado_ano_max':'' ,'fblistado_ord_tipo':'','listado_bcad':xurl,'ak':ak,'ourl':'http://www.peliculaspepito.com/peliculas/','spfin':'buscador_Listar_Fin'} html = net.http_POST('http://www.peliculaspepito.com/ajax/buscador_catalogo',post_data,header).content html=html.replace('\\\\','') html=html.replace('\\','') final=html match=re.compile('src=\\\"(.+?)\\\" \/><\/a><div id=\\\".+?\\\" class=\\\".+?\\\"><p><a title=\\\"(.+?)\\\" href=\\\"(.+?)\/\\\">.+?<\/a><\/p><p class=\\\".+?\\\">(.+?)class="pidilis',re.DOTALL).findall(str(final)) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until Movie list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Movies loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(0,'[B]Will load instantly from now on[/B]',remaining_display) for thumb, name, url, lang in match: if 'flag flag_0' in lang: name= name+' [COLOR blue]ESP[/COLOR]' if 'flag flag_1' in lang: name= name+' [COLOR yellow]LAT[/COLOR]' if 'flag flag_2' in lang: name= name+' [COLOR red]ENG[/COLOR]' if 'flag flag_3' in lang: name= name+' [COLOR green]SUB[/COLOR]' main.addDirM(name,url,307,thumb,'','','','','') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = 'Movies loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(percent,'[B]Will load instantly from now on[/B]',remaining_display) if (dialogWait.iscanceled()): return False dialogWait.close() del dialogWait main.GA("INT","Peliculaspepito")
def analyzer(url,name,play=True): final='' mensagemprogresso.create('Karaoke Português', traducao(40025)) mensagemprogresso.update(0) from t0mm0.common.net import Net net=Net() if re.search('ptk',url) or re.search('jdi',url) or re.search('kam',url) or re.search('oth',url):filetype='.mp4' else: filetype='.avi' conteudo=abrir_url_cookie(MainURL + str(entrada.decode('rot13')) + 'all/' + url + filetype) if re.search('Pode acontecer que a mensagem de confirma',conteudo): mensagemok('Karaoke Português','Necessitas de activar a tua conta abelhas.') return try: fileid=re.compile('<input type="hidden" name="FileId" value="(.+?)"/>').findall(conteudo)[0] token=re.compile('<input name="__RequestVerificationToken" type="hidden" value="(.+?)" />').findall(conteudo)[0] form_d = {'fileId':fileid,'__RequestVerificationToken':token} ref_data = {'Accept': '*/*', 'Content-Type': 'application/x-www-form-urlencoded','Origin': 'http://abelhas.pt', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'http://abelhas.pt/','User-Agent':user_agent} endlogin=MainURL + 'action/License/Download' final= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore') final=final.replace('\u0026','&').replace('\u003c','<').replace('\u003e','>').replace('\\','') except: mensagemok('Karaoke Português','Ficheiro indisponivel.') try: if re.search('action/License/acceptLargeTransfer',final): fileid=re.compile('<input type="hidden" name="fileId" value="(.+?)"').findall(final)[0] orgfile=re.compile('<input type="hidden" name="orgFile" value="(.+?)"').findall(final)[0] userselection=re.compile('<input type="hidden" name="userSelection" value="(.+?)"').findall(final)[0] form_d = {'fileId':fileid,'orgFile':orgfile,'userSelection':userselection,'__RequestVerificationToken':token} ref_data = {'Accept': '*/*', 'Content-Type': 'application/x-www-form-urlencoded','Origin': 'http://abelhas.pt', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'http://abelhas.pt/','User-Agent':user_agent} endlogin=MainURL + 'action/License/acceptLargeTransfer' final= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore') except: pass try: if re.search('causar problemas com o uso de aceleradores de download',final):linkfinal=re.compile('a href=\"(.+?)\"').findall(final)[0] else: linkfinal=re.compile('"redirectUrl":"(.+?)"').findall(final)[0] except: if re.search('Por favor tenta baixar este ficheiro mais tarde.',final): mensagemok('Karaoke Português',traducao(40026)) return else: linkfinal='' mensagemok('Karaoke Português',traducao(40027)) print str(final) print str(linkfinal) return mensagemprogresso.close() if play==True: comecarvideo(name,linkfinal) else: return (url + filetype),linkfinal
def login_abelhas(): print "Sem cookie. A iniciar login" from t0mm0.common.net import Net net=Net() try: link=abrir_url(MainURL) token=re.compile('<input name="__RequestVerificationToken" type="hidden" value="(.+?)" />').findall(link)[0] form_d = {'RedirectUrl':'','Redirect':'True','FileId':0,'Login':username,'Password':password,'RememberMe':'true','__RequestVerificationToken':token} ref_data = {'Accept': '*/*', 'Content-Type': 'application/x-www-form-urlencoded','Origin': 'http://abelhas.pt', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'http://abelhas.pt/','User-Agent':user_agent} endlogin=MainURL + 'action/login/login' try: logintest= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore') except: logintest='Erro' except: link='Erro' logintest='Erro' if selfAddon.getSetting('abelhas-username')== '': ok = mensagemok('Karaoke Português',traducao(40000),traducao(40001)) entrarnovamente(1) else: if re.search('003eA senha indicada n',logintest): mensagemok('Karaoke Português',traducao(40002)) entrarnovamente(1) elif re.search('existe. Certifica-te que indicaste o nome correcto.',logintest): mensagemok('Karaoke Português',traducao(40003)) entrarnovamente(1) elif re.search(username,logintest): #xbmc.executebuiltin("XBMC.Notification(Karaoke Português,"+traducao(40004)+",'500000',"+iconpequeno.encode('utf-8')+")") net.save_cookies(cookies) conteudo=clean(abrir_url_cookie(MainURL + str(entrada.decode('rot13')))) if re.search('ProtectedFolderChomikLogin',conteudo): chomikid=re.compile('<input id="ChomikId" name="ChomikId" type="hidden" value="(.+?)" />').findall(conteudo)[0] folderid=re.compile('<input id="FolderId" name="FolderId" type="hidden" value="(.+?)" />').findall(conteudo)[0] foldername=re.compile('<input id="FolderName" name="FolderName" type="hidden" value="(.+?)" />').findall(conteudo)[0] token=re.compile('<input name="__RequestVerificationToken" type="hidden" value="(.+?)" />').findall(conteudo)[0] routinas1='Cnffjbeq'; routinas2='enzobvn' form_d = {'ChomikId':chomikid,'FolderId':folderid,'FolderName':foldername,str(routinas1.decode('rot13')):str(routinas2.decode('rot13')),'Remember':'true','__RequestVerificationToken':token} ref_data = {'Accept':'*/*','Content-Type':'application/x-www-form-urlencoded','Host':'abelhas.pt','Origin':'http://abelhas.pt','Referer':url,'User-Agent':user_agent,'X-Requested-With':'XMLHttpRequest'} endlogin=MainURL + 'action/Files/LoginToFolder' teste= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore') verificarbd() menu_principal(1) elif re.search('Erro',logintest) or link=='Erro': opcao= xbmcgui.Dialog().yesno('Karaoke Português', traducao(40005), "", "",traducao(40006), 'OK') if opcao: menu_principal(0) else: login_abelhas()
class watchfreeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "watchfreeinhd" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html=self.net.http_POST(web_url,{'agree':'Yes, let me watch'}).content link=re.compile('<a href="(.+?)" id="player" name="player">').findall(html)[0] return link def get_url(self, host, media_id): return 'http://www.%s.com/%s' % (host,media_id) def get_host_and_id(self, url): r = re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)',url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)',url) or 'watchfree' in host)
class PlayedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "played" domains = ["played.to"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url, {'host': 'played.to'}).content r = re.findall(r'<input type="hidden" name="(.+?)"\s* value="(.*?)"', html) data = {} for name, value in r: data[name] = value data.update({'btn_download': 'Continue to Video'}) html = self.net.http_POST(web_url, data).content match = re.search('file: "(.+?)"', html) if match: return match.group(1) else: raise UrlResolver.ResolverError('unable to locate video') def get_url(self, host, media_id): return 'http://played.to/%s' % (media_id) def get_host_and_id(self, url): r = re.match(r'http://(?:www.)?(played).to/(?:embed-)?([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(r'http://(?:www.)?(played).to/(?:embed-)?([0-9a-zA-Z]+)', url) or 'played' in host
class VidxdenResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidxden" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) """ Human Verification """ try: resp = self.net.http_GET(web_url) html = resp.content try: os.remove(img) except: pass try: filename=re.compile('<input name="fname" type="hidden" value="(.+?)">').findall(html)[0] noscript=re.compile('<iframe src="(.+?)"').findall(html)[0] check = self.net.http_GET(noscript).content hugekey=re.compile('id="adcopy_challenge" value="(.+?)">').findall(check)[0] headers= {'User-Agent':'Mozilla/6.0 (Macintosh; I; Intel Mac OS X 11_7_9; de-LI; rv:1.9b4) Gecko/2012010317 Firefox/10.0a4', 'Host':'api.solvemedia.com','Referer':resp.get_url(),'Accept':'image/png,image/*;q=0.8,*/*;q=0.5'} open(img, 'wb').write( self.net.http_GET("http://api.solvemedia.com%s"%re.compile('<img src="(.+?)"').findall(check)[0]).content) solver = InputWindow(captcha=img) puzzle = solver.get() if puzzle: data={'adcopy_response':urllib.quote_plus(puzzle),'adcopy_challenge':hugekey,'op':'download1','method_free':'1','usr_login':'','id':media_id,'fname':filename} html = self.net.http_POST(resp.get_url(),data).content except Exception, e: print e xbmc.executebuiltin('XBMC.Notification([B][COLOR white]VIDXDEN[/COLOR][/B],[COLOR red]No such file or the file has been removed due to copyright infringement issues[/COLOR],2500,'+logo+')') pass except urllib2.URLError, e: common.addon.log_error('vidxden: got http error %d fetching %s' % (e.code, web_url)) return False #find packed javascript embed code r = re.search('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split',html) if r: p, k = r.groups() else: common.addon.log_error('vidxden: packed javascript embed code not found') try: decrypted_data = unpack_js(p, k) except: pass #First checks for a flv url, then the if statement is for the avi url r = re.search('file.\',.\'(.+?).\'', decrypted_data) if not r: r = re.search('src="(.+?)"', decrypted_data) if r: stream_url = r.group(1) else: common.addon.log_error('vidxden: stream url not found') return False return "%s|User-Agent=%s"%(stream_url,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0')
class watchfreeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "watchfreeinhd" domains = [ "watchfreeinhd.com" ] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html=self.net.http_POST(web_url,{'agree':'Yes, let me watch'}).content link=re.findall('<a href="(.+?)" id="player" name="player">',html) if link: return link[0] raise Exception ('File Not Found or removed') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log('**** Watchfreeinhd Error occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]WATCHFREEINHD[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
def PostContent(formvar,url): try: net = Net() headers = {} headers['Accept']='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' headers['Accept-Encoding'] = 'gzip, deflate' headers['Accept-Charset']='ISO-8859-1,utf-8;q=0.7,*;q=0.7' headers['Referer'] = 'http://www.khmeraccess.com/video/videolist/videonew.html?cid=1' headers['Content-Type'] = 'application/x-www-form-urlencoded' headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1' headers['Connection'] = 'keep-alive' headers['Host']='www.khmeraccess.com' headers['Accept-Language']='en-us,en;q=0.5' headers['Pragma']='no-cache' formdata={} formdata['start']=formvar #first_response = net.http_Get('http://khmerfever.com/wp-login.php',headers=header_dict) #net.save_cookies('c:\cookies.txt') #net.set_cookies('c:\cookies.txt') second_response = net.http_POST(url,formdata,headers=headers,compression=False) return second_response.content except: d = xbmcgui.Dialog() d.ok('Time out',"Can't Connect to site",'Try again in a moment')
class MightyuploadResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mightyupload" domains = ["mightyupload.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content form_values = {} stream_url = None for i in re.finditer('<input type="hidden" name="(.*?)" value="(.*?)"', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(web_url, form_data=form_values).content r = re.search('<IFRAME SRC="(.*?)" .*?></IFRAME>', html, re.DOTALL) if r: html = self.net.http_GET(r.group(1)).content r = re.search("<div id=\"player_code\">.*?<script type='text/javascript'>(.*?)</script>", html, re.DOTALL) if not r: raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Player config not found.') r_temp = re.search("file: '([^']+)'", r.group(1)) if r_temp: stream_url = r_temp.group(1) else: js = jsunpack.unpack(r.group(1)) r = re.search("'file','([^']+)'", js.replace('\\', '')) if not r: r = re.search('"src"value="([^"]+)', js.replace('\\', '')) if not r: raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Filelink not found.') stream_url = r.group(1) if stream_url: return stream_url + '|User-Agent=%s' % (common.IE_USER_AGENT) else: raise UrlResolver.ResolverError('Unable to resolve link') def get_url(self, host, media_id): return 'http://www.mightyupload.com/embed-%s.html' % (media_id) def get_host_and_id(self, url): r = re.search('http://(?:www.)?(.+?)/embed-([\w]+)-', url) if r: return r.groups() else: r = re.search('//(.+?)/([\w]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.match('http://(www.)?mightyupload.com/[0-9A-Za-z]+', url) or 'mightyupload' in host
class playedResolver(Plugin,UrlResolver,PluginSettings): implements=[UrlResolver,PluginSettings] name="played" def __init__(self): p=self.get_setting('priority') or 100 self.priority=int(p) self.net=Net() def get_media_url(self, host, media_id): web_url=self.get_url(host,media_id) try: html=self.net.http_GET(web_url,{'host':'played.to'}).content try: played=re.compile('file: "(.+?)"').findall(html)[0] if len(played) > 12: return played except: pass id=re.compile('<input type="hidden" name="id" value="(.+?)">').findall(html)[0] fname=re.compile('<input type="hidden" name="fname" value="(.+?)">').findall(html)[0] hash=re.compile('<input type="hidden" name="hash" value="(.+?)">').findall(html)[0] data={'op':'download1','usr_login':'','id':id,'fname':fname,'referer':'','hash':hash,'imhuman':'Continue+to+Video'} html=self.net.http_POST(web_url,data).content played=re.compile('file: "(.+?)"').findall(html)[0] return played except urllib2.URLError, e: common.addon.log_error('Played: got http error %d fetching %s' % (e.code,web_url)) common.addon.show_small_popup('Error','Http error: '+str(e),5000,error_logo) return self.unresolvable(code=3,msg=e) except Exception, e: common.addon.log_error('**** Played Error occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]PLAYED[/COLOR][/B]',msg='[COLOR red]%s[/COLOR]' % e,delay=5000,image=error_logo) return self.unresolvable(code=0,msg=e)
class SharedsxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharedsx" domains = ["shared.sx"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) # get landing page html = self.net.http_GET(web_url, headers={'Referer': web_url}).content # read POST variables into data data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) if not r: raise UrlResolver.ResolverError('page structure changed') for name, value in r: data[name] = value # get delay from hoster; actually this is not needed, but we are polite delay = 5 r = re.search(r'var RequestWaiting = (\d+);', html) if r: delay = r.groups(1)[0] # run countdown and check whether it was canceld or not cnt = common.addon.show_countdown(int(delay), title='shared.sx', text='Please wait for hoster...') if not cnt: raise UrlResolver.ResolverError('countdown was canceld by user') # get video page using POST variables html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content # search for content tag r = re.search(r'class="stream-content" data-url', html) if not r: raise UrlResolver.ResolverError('page structure changed') # read the data-url r = re.findall(r'data-url="?(.+?)"', html) if not r: raise UrlResolver.ResolverError('video not found') # return media URL return r[0] def get_url(self, host, media_id): return 'http://shared.sx/%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False return('host', 'media_id') def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?shared.sx/' + '[0-9A-Za-z]+', url) or 'shared.sx' in host)
def PostContent(formvar, url): try: net = Net() headers = {} headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" headers["Accept-Encoding"] = "gzip, deflate" headers["Accept-Charset"] = "ISO-8859-1,utf-8;q=0.7,*;q=0.7" headers["Referer"] = "http://www.khmeraccess.com/video/videolist/videonew.html?cid=1" headers["Content-Type"] = "application/x-www-form-urlencoded" headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1" headers["Connection"] = "keep-alive" headers["Host"] = "www.khmeraccess.com" headers["Accept-Language"] = "en-us,en;q=0.5" headers["Pragma"] = "no-cache" formdata = {} formdata["start"] = formvar # first_response = net.http_Get('http://khmerfever.com/wp-login.php',headers=header_dict) # net.save_cookies('c:\cookies.txt') # net.set_cookies('c:\cookies.txt') second_response = net.http_POST(url, formdata, headers=headers, compression=False) return second_response.content except: d = xbmcgui.Dialog() d.ok("Time out", "Can't Connect to site", "Try again in a moment")
class NosvideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "nosvideo" domains = ["nosvideo.com", "noslocker.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): url = self.get_url(host, media_id) html = self.net.http_GET(url).content if 'File Not Found' in html: raise UrlResolver.ResolverError('File Not Found') headers = { 'Referer': url } data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="(.+?)"', html) for name, value in r: data[name] = value data.update({'method_free': 'Free Download'}) html = self.net.http_POST(url, data, headers=headers).content r = re.search('(eval\(function\(p,a,c,k,e,[dr].*)', html) if r: js = jsunpack.unpack(r.group(1)) r = re.search('playlist=([^&]+)', js) if r: html = self.net.http_GET(r.group(1)).content r = re.search('<file>\s*(.*)\s*</file>', html) if r: return r.group(1) else: raise UrlResolver.ResolverError('Unable to locate video file') else: raise UrlResolver.ResolverError('Unable to locate playlist') else: raise UrlResolver.ResolverError('Unable to locate packed data') def get_url(self, host, media_id): return 'http://nosvideo.com/?v=%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/(?:\?v\=|embed/)?([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False return('host', 'media_id') def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?(nosvideo|noslocker).com/' + '(?:\?v\=|embed/)[0-9A-Za-z]+', url) or 'nosvideo' in host)
def noswifi(): #obrigado darkstar pelos tiros a escura checkurl = "http://example.com" html=abrir_url_cookie(checkurl) if html.find('action="https://zon.portal.fon.com') >= 0: print "Info inicial: " + str(html) m = re.search('action="(https://zon.[^"]+)"',html) if(m == None): mensagemok('Hotspot Connector',"Actionurl não encontrado.","Volte a tentar mais tarde.") return actionUrl = m.group(1) from t0mm0.common.net import Net net=Net() net.set_cookies(cookie_nos) data = {'USERNAME' : noswifiUsername, 'PASSWORD' : noswifiPassword,'remember':'on'} ref_data = {'User-Agent':user_agent} html= net.http_POST(actionUrl,form_data=data,headers=ref_data).content.encode('latin-1','ignore') print "Teste Login: "******"error"><span>([^<]+)<br /></span></div>', html) if(m == None): try: addLink('[B]Login efectuado ou não necessário[/B]','',wtpath + art + 'noswifi.png') except: pass else: try: addLink(m.group(1),'',wtpath + art + 'noswifi.png') except: pass else: try: addLink('[B]Login efectuado ou não necessário[/B]','',wtpath + art + 'noswifi.png') except: pass
class CyberlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "cyberlocker" domains = ["cyberlocker.ch"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): url = self.get_url(host, media_id) html = self.net.http_GET(url).content r = re.findall('<center><h3>File Not Found</h3></center><br>', html, re.I) if r: raise UrlResolver.ResolverError('File Not Found or removed') if not r: data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value data['method_free'] = 'Wait for 0 seconds' html = self.net.http_POST(url, data).content sPattern = '<script type=(?:"|\')text/javascript(?:"|\')>(eval\(' sPattern += 'function\(p,a,c,k,e,d\)(?!.+player_ads.+).+np_vid.+?)' sPattern += '\s+?</script>' r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) if r: sJavascript = r.group(1) sUnpacked = jsunpack.unpack(sJavascript) sPattern = '<embed id="np_vid"type="video/divx"src="(.+?)' sPattern += '"custommode=' r = re.search(sPattern, sUnpacked) if r: return r.group(1) else: num = re.compile('cyberlocker\|(.+?)\|http').findall(html) pre = 'http://'+num[0]+'.cyberlocker.ch:182/d/' preb = re.compile('image\|(.+?)\|video\|(.+?)\|').findall(html) for ext, link in preb: r = pre+link+'/video.'+ext return r def get_url(self, host, media_id): return 'http://cyberlocker.ch/%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/([0-9a-zA-Z]+)',url) if r: return r.groups() else: return False return('host', 'media_id') def valid_url(self, url, host): return (re.match('http://(www.)?cyberlocker.ch/' + '[0-9A-Za-z]+', url) or 'cyberlocker' in host)
class PutlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "putlocker/sockshare/filedrive/firedrive" profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'putlocker.cookies') def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): if self.get_setting('login') == 'true': if self.login_stale(): self.login() self.net.set_cookies(self.cookie_file) web_url = self.get_url(host, media_id) if web_url[-1:1]=="#": web_url.replace("#",""); #find session_hash try: html = self.net.http_GET(web_url).content if "404: This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": 404: This file might have been moved, replaced or deleted.") #firedrive error elif ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") #sockshare error #Shortcut for logged in users pattern = '<a href="(/.+?)" class="download_file_link" style="margin:0px 0px;">Download File</a>' link = re.search(pattern, html) if link: common.addon.log('Direct link found: %s' % link.group(1)) if 'putlocker' in host: return 'http://www.filedrive.com%s' % link.group(1) #return 'http://www.putlocker.com%s' % link.group(1) elif 'filedrive' in host: return 'http://www.filedrive.com%s' % link.group(1) elif 'firedrive' in host: return 'http://www.firedrive.com%s' % link.group(1) if 'firedrive' in host or 'filedrive' in host or 'putlocker' in host or 'sockshare' in host: try: data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); #data['usr_login']='' for name, value in r: data[name] = value #data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' #xbmc.sleep(2000) html = self.net.http_POST(web_url, data).content except urllib2.URLError, e: common.addon.log_error(host+': got http error %d fetching 2nd url %s' % (e.code, web_url)) return self.unresolvable(code=3, msg='Exception: %s' % e) #return False r = re.search('<a href="(.+?)" id=\'external_download\' title=\'Download This File\'>', html) if r: return urllib.unquote_plus(r.group(1)) #else: # common.addon.log_error(host+': stream url not found') # return self.unresolvable(code=0, msg='no file located') #return False r = re.search("$.post('(.+?)', function(data) {", html) if r: return urllib.unquote_plus(r.group(1)) else: common.addon.log_error(host+': stream url not found') return self.unresolvable(code=0, msg='no file located') #return False else:
class PromptfileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "promptfile" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content data = {} r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value html = self.net.http_POST(web_url, data).content html = re.compile(r'clip\s*:\s*\{.*?url\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html) if not html: raise Exception ('File Not Found or removed') stream_url = html.group(1) return stream_url except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Promptfile Error occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]PROMPTFILE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class playedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "played" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html=self.net.http_GET(web_url,{'host':'played.to'}).content id=re.compile('<input type="hidden" name="id" value="(.+?)">').findall(html)[0] fname=re.compile('<input type="hidden" name="fname" value="(.+?)">').findall(html)[0] hash=re.compile('<input type="hidden" name="hash" value="(.+?)">').findall(html)[0] data={'op':'download1','usr_login':'','id':id,'fname':fname,'referer':'','hash':hash,'imhuman':'Continue+to+Video'} html=self.net.http_POST(web_url,data).content played=re.compile('file: "(.+?)"').findall(html)[0] return played def get_url(self, host, media_id): return 'http://played.to/%s' % (media_id) def get_host_and_id(self, url): r = re.match(r'http://(played).to/([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(r'http://(played).to/([0-9a-zA-Z]+)', url) or 'played' in host
class WatchFreeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "watchfreeinhd" domains = ["watchfreeinhd.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_POST(web_url, {'agree': 'Yes, let me watch'}).content link = re.findall('<a href="(.+?)" id="player" name="player">', html) if link: return link[0] else: raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://www.%s.com/%s' % (host, media_id) def get_host_and_id(self, url): r = re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): return (re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)', url) or 'watchfree' in host)
class playedResolver(Plugin,UrlResolver,PluginSettings): implements=[UrlResolver,PluginSettings] name="played" def __init__(self): p=self.get_setting('priority') or 100 self.priority=int(p) self.net=Net() def get_media_url(self,host,media_id): web_url=self.get_url(host,media_id) try: data={}; html=self.net.http_GET(web_url,{'host':'played.to'}).content r=re.findall(r'<input type="hidden" name="(.+?)"\s* value="(.*?)"',html) for name,value in r: data[name]=value data.update({'btn_download':'Continue to Video'}) html=self.net.http_POST(web_url,data).content match=re.search('file: "(.+?)"',html) if match: return match.group(1) else: return self.unresolvable(code=0,msg='unable to locate video') except urllib2.URLError, e: common.addon.log_error('Played: got http error %d fetching %s'%(e.code,web_url)) common.addon.show_small_popup('Error','Http error: '+str(e),5000,error_logo) return self.unresolvable(code=3,msg=e) except Exception, e: common.addon.log_error('**** Played Error occured: %s'%e) common.addon.show_small_popup(title='[B][COLOR white]PLAYED[/COLOR][/B]',msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) return self.unresolvable(code=0,msg=e)
class CloudyvideosResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "cloudyvideos" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content form_values = {} for i in re.finditer('<input type="hidden" name="(.*?)" value="(.*?)"', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(web_url, form_data=form_values).content r = re.search("file: '([^']+)'",html) if not r: raise Exception ('Unable to resolve cloudyvideos link. Filelink not found.') return r.group(1) except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** cloudyvideos Error occured: %s' % e) return self.unresolvable(code=0, msg='Exception: %s' % e)
class FilenukeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "filenuke" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() #e.g. http://www.filenuke.com/embed-rw52re7f5aul.html # http://www.filenuke.com/w8w7ow5nqu7r self.pattern = 'http://((?:www.)?filenuke.com)/([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: resp = self.net.http_GET(web_url) html = resp.content post_url = resp.get_url() form_values = {} for i in re.finditer('<input type="hidden" name="(.+?)" value="(.+?)">', html): form_values[i.group(1)] = i.group(2) for i in re.finditer('<input type="submit" name="(.+?)" class="btn-big2-2" style="border: none;" value="(.+?)">', html): form_values[i.group(1)] = i.group(2) form_values[u'usr_login'] = u'' form_values[u'referer'] = u'' form_values[u'op'] = u'download1' html = self.net.http_POST(post_url, form_data=form_values).content r = re.findall('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split',html) if r: p = r[1][0] k = r[1][1] else: raise Exception ('File Not Found or removed') decrypted_data = unpack_js(p, k) #First checks for a flv url, then the if statement is for the avi url r = re.search('file.\',.\'(.+?).\'', decrypted_data) if not r: r = re.search('src="(.+?)"', decrypted_data) if r: stream_url = r.group(1) else: raise Exception ('File Not Found or removed') return stream_url except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Filenuke Error occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]FILENUKE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class UfliqResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "ufliq" def __init__(self): p = self.get_setting("priority") or 100 self.priority = int(p) self.net = Net() # e.g. http://www.ufliq.com/embed-rw52re7f5aul.html self.pattern = "http://((?:www.)?ufliq.com)/(?:embed-)?([0-9a-zA-Z]+)" def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: resp = self.net.http_GET(web_url) html = resp.content post_url = resp.get_url() print post_url form_values = {} for i in re.finditer('<input type="hidden" name="(.+?)" value="(.+?)">', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(post_url, form_data=form_values).content except urllib2.URLError, e: common.addon.log_error("gorillavid: got http error %d fetching %s" % (e.code, web_url)) return False r = re.search("url: '(.+?)', autoPlay: false,onBeforeFinish:", html) if r: return r.group(1) return False
def login_docspt(): print "Sem cookie. A iniciar login" try: from t0mm0.common.net import Net net=Net() #form_d = {'user':username,'passwrd':password,'cookieneverexp':'on','hash_passwrd':token} form_d={'user':username,'passwrd':password,'cookielength':-1} ref_data = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Content-Type': 'application/x-www-form-urlencoded','Host':'www.docspt.com','Origin': 'http://www.docspt.com', 'Referer': 'http://www.docspt.com/index.php?action=login2','User-Agent':user_agent} endlogin=MainURL + 'index.php?action=login2' try: logintest= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore') except: logintest='Erro' except: link='Erro' logintest='Erro' if selfAddon.getSetting('docspt-username')== '': ok = mensagemok('docsPT','Necessitas de criar conta em','docsPT.com') entrarnovamente(1) else: if re.search('<p class="error">A password est',logintest): mensagemok('docsPT','Password incorrecta.') entrarnovamente(1) elif re.search('<p class="error">Esse utilizador n',logintest): mensagemok('docsPT','Esse utilizador não existe.') entrarnovamente(1) elif re.search(username+'!</li>',logintest): xbmc.executebuiltin("XBMC.Notification(docsPT,Sessão iniciada com sucesso,'500000','')") net.save_cookies(cookies) menu_principal(1) elif re.search('Erro',logintest) or link=='Erro': opcao= xbmcgui.Dialog().yesno('docsPT', 'Sem acesso à internet.', "", "","Tentar novamente", 'OK') if opcao: menu_principal(0) else: login_docspt()
class VidxdenResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidxden" def __init__(self): p = self.get_setting("priority") or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: resp = self.net.http_GET(web_url) html = resp.content if "No such file or the file has been removed due to copyright infringement issues." in html: raise Exception("File Not Found or removed") filename = re.compile('<input name="fname" type="hidden" value="(.+?)">').findall(html)[0] data = {"op": "download1", "method_free": "1", "usr_login": "", "id": media_id, "fname": filename} # Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) html = self.net.http_POST(resp.get_url(), data).content # find packed javascript embed code r = re.search("(eval.*?)\s*</script>", html, re.DOTALL) if r: packed_data = r.group(1) else: common.addon.log_error("vidxden: packed javascript embed code not found") raise Exception("packed javascript embed code not found") try: decrypted_data = jsunpack.unpack(packed_data) except: pass # First checks for a flv url, then the if statement is for the avi url r = re.search("file.',.'(.+?).'", decrypted_data) if not r: r = re.search('src="(.+?)"', decrypted_data) if r: stream_url = r.group(1) else: raise Exception("vidxden: stream url not found") return "%s" % (stream_url) except urllib2.HTTPError, e: common.addon.log_error("Vidxden: got http error %d fetching %s" % (e.code, web_url)) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error("**** Vidxden Error occured: %s" % e) return self.unresolvable(code=0, msg=e)
class EcostreamResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "ecostream" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?ecostream.tv)/(?:stream|embed)?/([0-9a-zA-Z]+).html' def get_media_url(self, host, media_id): # emulate click on button "Start Stream" (ss=1) web_url = self.get_url(host, media_id) + "?ss=1" try: html = self.net.http_POST(web_url,{'ss':'1'}).content except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) return False # get vars sPattern = "var t=setTimeout\(\"lc\('([^']+)','([^']+)','([^']+)','([^']+)'\)" r = re.findall(sPattern, html) if r: for aEntry in r: sS = str(aEntry[0]) sK = str(aEntry[1]) sT = str(aEntry[2]) sKey = str(aEntry[3]) # get name of php file try: html = self.net.http_GET('http://www.ecostream.tv/assets/js/common.js').content except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) return False sPattern = '4/(.*?)\.8\?s=' r = re.search(sPattern, html) if r is None : common.addon.log_error(self.name + ': name of php file not found') return False # send vars and retrieve stream url sNextUrl = 'http://www.ecostream.tv/lc/'+r.group(1)+'.php?s='+sS+'&k='+sK+'&t='+sT+'&key='+sKey postParams = ({'s':sS,'k':sK,'t':sT,'key':sKey}) postHeader = ({'Referer':'http://www.ecostream.tv', 'X-Requested-With':'XMLHttpRequest'}) try: html = self.net.http_POST(sNextUrl, postParams,headers = postHeader).content except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, sNextUrl)) return False sPattern = '<param name="flashvars" value="file=(.*?)&' r = re.search(sPattern, html) if r: sLinkToFile = 'http://www.ecostream.tv'+r.group(1) return sLinkToFile
class BestreamsResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "bestreams" domains = ["bestreams.net"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content headers = { 'Referer': web_url } data = {} for r in re.finditer(r'type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html): data[r.group(1)] = r.group(2) data.update({'referer': web_url}) data.update({'imhuman': 'Proceed to video'}) # parse cookies from file as they are only useful for this interaction cookies = ['lang=1'] for match in re.finditer("\$\.cookie\('([^']+)',\s*'([^']+)", html): key, value = match.groups() cookies.append('%s=%s' % (key, urllib.quote_plus(value))) headers['Cookie'] = '; '.join(cookies) xbmc.sleep(2000) # POST seems to fail is submitted too soon after GET. Page Timeout? #sleep(2) html = self.net.http_POST(web_url, data, headers=headers).content r = re.search('file\s*:\s*"(http://.+?)"', html) # Incase they start using this again. if r: return r.group(1) r = re.search('streamer\s*:\s*"(\D+://.+?)"', html) r2 = re.search('file\s*:\s*"([^"]+)', html) if r and r2: return r.group(1) + " Playpath=" + r2.group(1) + " swfUrl=http://bestreams.net/player/player.swf pageUrl=http://bestreams.net swfVfy=1" # live=false timeout=30 if r: return r.group(1) raise UrlResolver.ResolverError("File Link Not Found") def get_url(self, host, media_id): return 'http://bestreams.net/%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/(?:embed-)?([A-Za-z0-9]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.match('http://(www.)?bestreams.net/(embed-)?[A-Za-z0-9]+', url) or "bestreams.net" in host
class PrimeshareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "primeshare" profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'primeshare.cookies') def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content if re.search('>File not exist<', html): msg = 'File Not Found or removed' common.addon.show_small_popup( title='[B][COLOR white]PRIMESHARE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % msg, delay=5000, image=error_logo) return self.unresolvable(code=1, msg=msg) self.net.save_cookies(self.cookie_file) headers = {'Referer': web_url} # wait required common.addon.show_countdown(8) self.net.set_cookies(self.cookie_file) html = self.net.http_POST(web_url, form_data={ 'hash': media_id }, headers=headers).content r = re.compile("clip:.*?url: '([^']+)'", re.DOTALL).findall(html) if not r: r = re.compile("download\('([^']+)'", re.DOTALL).findall(html) if not r: raise Exception( 'Unable to resolve Primeshare link. Filelink not found.') return r[0] except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 8000, error_logo) return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** Primeshare Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]PRIMESHARE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg='Exception: %s' % e)
class ZalaaResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "zalaa" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() #e.g. http://www.zalaa.com/hj0eyq4jg0io #FIXME: http://www.zalaa.com/npwp1cr4uys7/Nikita.S02E14.HDTV.XviD-LOL.avi.htm self.pattern = 'http://www.(zalaa.com)/([a-zA-Z0-9]+)(?:/.+?\.htm)?' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content #send all form values sPattern = '<input.*?name="([^"]+)".*?value=([^>]+)>' r = re.findall(sPattern, html) data = {} if r: for match in r: name = match[0] value = match[1].replace('"', '') data[name] = value html = self.net.http_POST(web_url, data).content else: raise Exception('File Not Found or removed') # modified by mscreations. get the file url from the returned javascript match = re.search("addVariable[(]'file','(.+?)'[)]", html, re.DOTALL + re.IGNORECASE) if match: return match.group( 1 ) + '|Referer=http%3A%2F%2Fwww.zalaa.com%2Fplayer%2Fplayer-embed.swf' raise Exception('File Not Found or removed') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 8000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log('**** Zalaa Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]ZALAA[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class VivosxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vivosx" domains = ["vivo.sx"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) # get landing page html = self.net.http_GET(web_url, headers={ 'Referer': web_url }).content # read POST variables into data data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) if not r: raise Exception('page structure changed') for name, value in r: data[name] = value # get delay from hoster; actually this is not needed, but we are polite delay = 5 r = re.search(r'var RequestWaiting = (\d+);', html) if r: delay = r.groups(1)[0] # get video page using POST variables html = self.net.http_POST(web_url, data, headers=({ 'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest' })).content # search for content tag r = re.search(r'class="stream-content" data-url', html) if not r: raise Exception('page structure changed') # read the data-url r = re.findall(r'data-url="?(.+?)"', html) if not r: raise Exception('video not found') # return media URL return r[0] except Exception, e: common.addon.log('vivosx: general error occured: %s' % e) return self.unresolvable(code=0, msg=e)
class KingFilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "KingFiles" domains = ["kingfiles.net"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = '//((?:www.)?kingfiles\.net)/([0-9a-zA-Z/]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content tries = 0 while tries < MAX_TRIES: data = {} for match in re.finditer( 'input type="hidden" name="([^"]+)" value="([^"]+)', html): key, value = match.groups() data[key] = value data['method_free'] = 'Free Download' data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(web_url, form_data=data).content # try to find source in packed data if jsunpack.detect(html): js_data = jsunpack.unpack(html) match = re.search('name="src"\s*value="([^"]+)', js_data) if match: return match.group(1) # try to find source in html match = re.search('<span[^>]*>\s*<a\s+href="([^"]+)', html, re.DOTALL) if match: return match.group(1) tries += 1 raise UrlResolver.ResolverError( 'Unable to resolve kingfiles link. Filelink not found.') def get_url(self, host, media_id): return 'http://kingfiles.net/%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class SharesixResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharesix" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: # Otherwise just use the original url to get the content. For sharesix html = self.net.http_GET(web_url).content data = {} r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value data["method_free"] = "Free" html = self.net.http_POST(web_url, data).content # To build the streamable link, we need # # the IPv4 addr (first 4 content below) # # the hash of the file metadata = re.compile( '\|\|?(\d+)\|\|?(\d+)\|\|?(\d+)\|\|?(\d+)\|.+?video\|(.+?)\|\|?file' ).findall(html) if (len(metadata) > 0): metadata = metadata[0] stream_url = "http://" + metadata[3] + "." + metadata[ 2] + "." + metadata[1] + "." + metadata[ 0] + "/d/" + metadata[4] + "/video.flv" return stream_url if 'file you were looking for could not be found' in html: raise Exception('File Not Found or removed') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 5000, error_logo) return False except Exception, e: common.addon.log_error('**** Sharesix Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]SHARESIX[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return False
class FileboxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "filebox" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() #e.g. http://www.filebox.com/embed-rw52re7f5aul.html self.pattern = 'http://((?:www.)?filebox.com)/(?:embed-)?([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: resp = self.net.http_GET(web_url) html = resp.content post_url = resp.get_url() dialog = xbmcgui.Dialog() if "video is not available for streaming right now. It's still converting..." in html: raise Exception( 'video is not available for streaming right now.') if "File was deleted" in html: raise Exception('File Not Found or removed') form_values = {} for i in re.finditer( '<input type="hidden" name="(.+?)" value="(.+?)">', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(post_url, form_data=form_values).content r = re.search('url: \'(.+?)\', autoPlay: false,onBeforeFinish:', html) print r if r: return r.group(1) raise Exception('File Not Found or removed') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 5000, error_logo) return False except Exception, e: common.addon.log_error('**** Filebox Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]FILEBOX[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return False
class UploadcResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uploadc" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() # modified by mscreations. uploadc now needs the filename after the media id so make sure we match that self.pattern = 'http://((?:www.)?uploadc.com)/([0-9a-zA-Z]+/[0-9a-zA-Z/._]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) #get html try: html = self.net.http_GET(web_url).content #send all form values sPattern = '<input.*?name="([^"]+)".*?value=([^>]+)>' r = re.findall(sPattern, html) data = {} if r: for match in r: name = match[0] value = match[1].replace('"', '') data[name] = value html = self.net.http_POST(web_url, data).content else: raise Exception('File Not Found or removed') # modified by mscreations. get the file url from the returned javascript match = re.search("addVariable[(]'file','(.+?)'[)]", html, re.DOTALL + re.IGNORECASE) if match: return match.group( 1 ) + '|Referer=http%3A%2F%2Fwww.uploadc.com%2Fplayer%2Fplayer-embed.swf' raise Exception('File Not Found or removed') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 8000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log('**** Uploadc Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]UPLOADC[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class Justmp4Resolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "justmp4.com" hostname2 = "justmp4" domains = ["justmp4.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?' + self.name + ')/\D+-embed/([0-9a-zA-Z\-_]+)*' def get_url(self, host, media_id): return 'http://%s/%s%s' % (self.name, 'kvp-embed/', media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.match(self.pattern, url) or self.name in host or self.hostname2 in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) post_url = web_url common.addon.log_debug(web_url) headers = {'Referer': web_url} html = self.net.http_GET(web_url).content data = {} r = re.findall(r'<input type="hidden"\s*value="(.*?)"\s*name="(.+?)"', html) if r: for value, name in r: data[name] = value xbmc.sleep(4000) html = self.net.http_POST(post_url, data, headers=headers).content try: r = re.compile( '<source src="(.+?)" data-res="(\d+)" type="video/([0-9A-Za-z]+)">' ).findall(html) except: r = [] ResList = [] UrlList = [] if len(r) > 0: for (aUrl, aRes, aFrmt) in r: ResList.append(aRes + ' ' + aFrmt) UrlList.append([aRes + ' ' + aFrmt, aUrl]) dialogSelect = xbmcgui.Dialog() index = dialogSelect.select('Select Resolution', ResList) try: return UrlList[index][1] except: raise UrlResolver.ResolverError('no file located')
class HugefilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "hugefiles" domains = ["hugefiles.net"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): url = self.get_url(host, media_id) common.addon.log_debug('HugeFiles - Requesting GET URL: %s' % url) html = self.net.http_GET(url).content if 'File Not Found' in html: raise UrlResolver.ResolverError('File Not Found or removed') #Set POST data values data = {} r = re.findall(r'type="hidden"\s+name="([^"]+)"\s+value="([^"]+)', html) if r: for name, value in r: data[name] = value else: raise UrlResolver.ResolverError('Cannot find data values') data['method_free'] = 'Free Download' data.update(captcha_lib.do_captcha(html)) common.addon.log_debug('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = self.net.http_POST(url, data).content r = re.search('fileUrl\s*=\s*"([^"]+)', html) if r: return r.group(1) raise UrlResolver.ResolverError('Unable to resolve HugeFiles Link') def get_url(self, host, media_id): return 'http://hugefiles.net/%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False return ('host', 'media_id') def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?hugefiles.net/' + '[0-9A-Za-z]+', url) or 'hugefiles' in host)
def login(): if __ADDON__.getSetting("email") == '' or __ADDON__.getSetting( 'password') == '': __ALERTA__('MrPiracy.xyz', 'Precisa de definir o seu email e password') return False else: try: net = Net() dados = { 'email': __ADDON__.getSetting("email"), 'password': __ADDON__.getSetting("password"), 'lembrar_senha': 'lembrar' } codigo_fonte = net.http_POST( __SITE__ + 'login_bd.php', form_data=dados, headers=__HEADERS__).content.encode('utf-8') match = re.compile('class="myAccount">(.+?)<\/a>').findall( codigo_fonte) except: resultado = False __ALERTA__( 'MrPiracy.xyz', 'Não foi possível abrir a página. Por favor tente novamente') match = '' return resultado if match == []: match = re.compile('class="myAccount">(.+?)<\/a>').findall( codigo_fonte) if match == []: resultado = False __ALERTA__('MrPiracy.xyz', 'Email e/ou Password incorretos') return resultado else: resultado = True xbmc.executebuiltin( "XBMC.Notification(MrPiracy.xyz, Sessão iniciada: " + __ADDON__.getSetting("email") + ", '10000', " + __ADDON_FOLDER__ + "/icon.png)") return resultado else: net.save_cookies(__COOKIE_FILE__) resultado = True xbmc.executebuiltin( "XBMC.Notification(MrPiracy.xyz, Sessão iniciada: " + __ADDON__.getSetting("email") + ", '10000', " + __ADDON_FOLDER__ + "/icon.png)") return resultado
class SharesixResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharesix" domains = ["sharesix.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: headers = {'User-Agent': USER_AGENT, 'Referer': web_url} # Otherwise just use the original url to get the content. For sharesix html = self.net.http_GET(web_url).content data = {} r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value #data[u"method_premium"] = "Premium"; data[u"method_free"] = "Free" data[u"op"] = "download1" data[u"referer"] = web_url data[u"usr_login"] = "" html = self.net.http_POST(web_url, data, headers=headers).content r = re.search("var\s+lnk1\s*=\s*'(.*?)'", html) if r: stream_url = r.group(1) + '|User-Agent=%s' % (USER_AGENT) return stream_url else: raise Exception('Unable to locate link') if 'file you were looking for could not be found' in html: raise Exception('File Not Found or removed') except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Sharesix Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]SHARESIX[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class GrifthostResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "grifthost" domains = ["grifthost.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = '//((?:www.)?grifthost\.com)/(?:embed-)?([0-9a-zA-Z/]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content data = {} for match in re.finditer( 'input type="hidden" name="([^"]+)" value="([^"]+)', html): key, value = match.groups() data[key] = value data['method_free'] = 'Proceed to Video' html = self.net.http_POST(web_url, form_data=data).content stream_url = '' for match in re.finditer('(eval\(function.*?)</script>', html, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) match2 = re.search('<param\s+name="src"\s*value="([^"]+)', js_data) if match2: stream_url = match2.group(1) else: match2 = re.search('file\s*:\s*"([^"]+)', js_data) if match2: stream_url = match2.group(1) if stream_url: return stream_url + '|User-Agent=%s&Referer=%s' % ( common.IE_USER_AGENT, web_url) raise UrlResolver.ResolverError( 'Unable to resolve grifthost link. Filelink not found.') def get_url(self, host, media_id): return 'http://grifthost.com/%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class VidxdenResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidxden" domains = ['vidxden.com', 'vidxden.to', 'divxden.com', 'vidbux.com', 'vidbux.to'] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: resp = self.net.http_GET(web_url) html = resp.content if "No such file or the file has been removed due to copyright infringement issues." in html: raise Exception('File Not Found or removed') filename = re.compile('<input name="fname" type="hidden" value="(.+?)">').findall(html)[0] data = {'op': 'download1', 'method_free': '1', 'usr_login': '', 'id': media_id, 'fname': filename} data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(resp.get_url(), data).content # find packed javascript embed code r = re.search('(eval.*?)\s*</script>', html, re.DOTALL) if r: packed_data = r.group(1) else: common.addon.log_error('vidxden: packed javascript embed code not found') raise Exception('packed javascript embed code not found') try: decrypted_data = jsunpack.unpack(packed_data) except: pass decrypted_data = decrypted_data.replace('\\', '') # First checks for a flv url, then the if statement is for the avi url r = re.search('[\'"]file[\'"]\s*,\s*[\'"]([^\'"]+)', decrypted_data) if not r: r = re.search('src="(.+?)"', decrypted_data) if r: stream_url = r.group(1) else: raise Exception('vidxden: stream url not found') return "%s" % (stream_url) except urllib2.HTTPError, e: common.addon.log_error('Vidxden: got http error %d fetching %s' % (e.code, web_url)) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Vidxden Error occured: %s' % e) return self.unresolvable(code=0, msg=e)
class ZalaaResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "zalaa" domains = ["zalaa.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() #e.g. http://www.zalaa.com/hj0eyq4jg0io #FIXME: http://www.zalaa.com/npwp1cr4uys7/Nikita.S02E14.HDTV.XviD-LOL.avi.htm self.pattern = 'http://www.(zalaa.com)/([a-zA-Z0-9]+)(?:/.+?\.htm)?' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content #send all form values sPattern = '<input.*?name="([^"]+)".*?value=([^>]+)>' r = re.findall(sPattern, html) data = {} if r: for match in r: name = match[0] value = match[1].replace('"', '') data[name] = value html = self.net.http_POST(web_url, data).content else: raise UrlResolver.ResolverError('File Not Found or removed') # modified by mscreations. get the file url from the returned javascript match = re.search("addVariable[(]'file','(.+?)'[)]", html, re.DOTALL + re.IGNORECASE) if match: return match.group( 1 ) + '|Referer=http%3A%2F%2Fwww.zalaa.com%2Fplayer%2Fplayer-embed.swf' else: raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://www.zalaa.com/%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host
class EcostreamResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "ecostream" profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'ecostream.cookies') def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?ecostream.tv)/(?:stream|embed)?/([0-9a-zA-Z]+).html' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content if re.search('>File not found!<',html): msg = 'File Not Found or removed' common.addon.show_small_popup(title='[B][COLOR white]ECOSTREAM[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % msg, delay=5000, image=error_logo) return self.unresolvable(code = 1, msg = msg) self.net.save_cookies(self.cookie_file) r = re.search("analytics='([^']+)'", html) if not r: raise Exception ('Formvalue not found') part1 = r.group(1) r = re.search("adslotid='([^']+)';", html) if not r: raise Exception ('Formvalue not found') part2 = r.group(1) tpm = part1+part2 # emulate click on button "Start Stream" postHeader = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'}) web_url = 'http://www.ecostream.tv/xhr/video/getstream' self.net.set_cookies(self.cookie_file) html = self.net.http_POST(web_url,{'id':media_id, 'tpm':tpm}, headers = postHeader).content sPattern = '"url":"([^"]+)"' r = re.search(sPattern, html) if not r: raise Exception ('Unable to resolve Ecostream link. Filelink not found.') sLinkToFile = 'http://www.ecostream.tv'+r.group(1) return urllib2.unquote(sLinkToFile) except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** Ecostream Error occured: %s' % e) common.addon.show_small_popup(title='[B][COLOR white]ECOSTREAM[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg='Exception: %s' % e)
def abrir_url_tommy(url,referencia,form_data=None,erro=True): print "A fazer request tommy de: " + url from t0mm0.common.net import Net net = Net() try: if form_data==None:link = net.http_GET(url,referencia).content else:link= net.http_POST(url,form_data=form_data,headers=referencia).content.encode('latin-1','ignore') return link except urllib2.HTTPError, e: return "Erro"
class streamintoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "streaminto" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() #e.g. http://streamin.to/20xk6r5vpkch self.pattern = 'http://((?:www.)?streamin.to)/(.*)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: resp = self.net.http_GET(web_url) html = resp.content post_url = web_url #resp.get_url() # get post vars form_values = {} for i in re.finditer('<input.*?name="(.*?)".*?value="(.*?)">', html): form_values[i.group(1)] = i.group(2) xbmc.sleep(5000) html = self.net.http_POST(post_url, form_data=form_values).content # get stream url pattern = 'streamer:\s*"([^"]+)",' #streamer: " file = 'file:\s*"([^"]+)",' #streamer: " r = re.search(pattern, html) rr = re.search(file, html) if r: return r.group(1).replace( ':1935', '' ) + ' swfUrl=http://streamin.to/player/player.swf live=true swfVfy=1 playpath=' + rr.group( 1).replace('.flv', '') raise Exception('File Not Found or removed') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 8000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log('**** streaminto Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]streaminto[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
def getStreamSRC(id): from t0mm0.common.net import Net net = Net() data = net.http_POST(streamurl.replace('{id}', id), { 'streamID': id }, { 'Referer': baseurl, 'X-Requested-With': 'XMLHttpRequest' }).content for url in re.findall('"url":"([^"]+)"', data, re.S | re.I): return url.replace('\\', '')
class BestreamsResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "bestreams" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content #print html.encode('ascii','ignore') headers = {'Referer': web_url} data = {} r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value data.update({'referer': web_url}) data.update({'imhuman': 'Proceed to video'}) #print data sleep( 2 ) # POST seems to fail is submitted too soon after GET. Page Timeout? html = self.net.http_POST(web_url, data, headers=headers).content #print html.encode('ascii','ignore') r = re.search('file\s*:\s*"(http://.+?)"', html) if r: return r.group(1) else: raise Exception("File Link Not Found") except urllib2.URLError, e: common.addon.log_error('bestreams: got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'beststreams: HTTP error: ' + str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('bestreams: general error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]BESTREAMS[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class TwentyFourUploadingResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "24uploading" domains = ["24uploading.com"] pattern = '(?://|\.)(24uploading\.com)/([0-9a-zA-Z/]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content tries = 0 while tries < MAX_TRIES: data = {} for match in re.finditer( r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html): key, value = match.groups() data[key] = value data['method_free'] = 'Free Download' html = self.net.http_POST(web_url, form_data=data).content for match in re.finditer('(eval\(function.*?)</script>', html, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) js_data = js_data.replace('\\\'', '\'') match2 = re.search("\"html5\".*?file\s*:\s*'([^']+)", js_data) if match2: stream_url = match2.group(1) return stream_url tries += 1 raise UrlResolver.ResolverError( 'Unable to resolve 24uploading link. Filelink not found.') def get_url(self, host, media_id): return 'http://24uploading.com/%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class MovDivxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "movdivx" domains = ["movdivx.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() #e.g. http://movdivx.com/trrrw4r6bjqu/American_Dad__s_1_e_3_p1-1.flv.html self.pattern = 'http://(?:www.)?(movdivx.com)/(.+?).html' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content data = {} for match in re.finditer('type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html): key, value = match.groups() data[key] = value data['method_free'] = 'Continue to Stream >>' html = self.net.http_POST(web_url, data).content # get url from packed javascript sPattern = '(eval\(function\(p,a,c,k,e,d\).*?)</script>' for match in re.finditer(sPattern, html, re.DOTALL | re.IGNORECASE): fragment = match.group(1) js_data = jsunpack.unpack(fragment) match = re.search('name="src"\s*value="([^"]+)', js_data) if match: return match.group(1) else: match = re.search('file\s*:\s*"([^"]+)', js_data) if match: return match.group(1) raise UrlResolver.ResolverError('failed to parse link') def get_url(self, host, media_id): return 'http://movdivx.com/%s.html' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.search(self.pattern, url) or self.name in host
class VidlockersResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidlockers" domains = ["vidlockers.ag"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?vidlockers.ag)/([A-Za-z0-9]+)/.*?' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content form_values = {} stream_url = '' for i in re.finditer('<input type="hidden" name="([^"]+)" value="([^"]+)', html): form_values[i.group(1)] = i.group(2) xbmc.sleep(2000) html = self.net.http_POST(web_url, form_data=form_values).content r = re.search('file\s*:\s*"([^"]+)', html) if r: stream_url = r.group(1) for match in re.finditer('(eval\(function.*?)</script>', html, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) match2 = re.search('<param\s+name="src"\s*value="([^"]+)', js_data) if match2: stream_url = match2.group(1) else: match2 = re.search('<embed.*?type="video.*?src="([^"]+)', js_data) if match2: stream_url = match2.group(1) if stream_url: return stream_url + '|User-Agent=%s&Referer=%s' % (common.IE_USER_AGENT, web_url) raise UrlResolver.ResolverError('Unable to resolve vidlockers link. Filelink not found.') def get_url(self, host, media_id): return 'http://vidlockers.ag/%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or 'vidlockers' in host
class SharefilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharefiles" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?sharefiles4u.com)/([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content #send all form values except premium sPattern = '<input.*?name="([^"]+)".*?value=([^>]+)>' r = re.findall(sPattern, html) data = {} for match in r: name = match[0] if 'premium' in name: continue value = match[1].replace('"', '') data[name] = value html = self.net.http_POST(web_url, data).content # get url from packed javascript sPattern = "<div id=\"player_code\">\s*<script type='text/javascript'>eval.*?return p}\((.*?)\)\s*</script>" r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) sJavascript = r.group(1) sUnpacked = jsunpack.unpack(sJavascript) sPattern = '<param name="src"0="(.*?)"' r = re.search(sPattern, sUnpacked) return r.group(1) except urllib2.URLError, e: common.addon.log_error( 'Sharefiles: got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Sharefiles Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]SHAREFILES[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class MightyuploadResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mightyupload" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content form_values = {} for i in re.finditer( '<input type="hidden" name="(.*?)" value="(.*?)"', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(web_url, form_data=form_values).content r = re.search( "<div id=\"player_code\">.*?<script type='text/javascript'>(.*?)</script>", html, re.DOTALL) if not r: raise Exception( 'Unable to resolve Mightyupload link. Player config not found.' ) r_temp = re.search("file: '([^']+)'", r.group(1)) if r_temp: return r_temp.group(1) js = jsunpack.unpack(r.group(1)) r = re.search("'file','([^']+)'", js.replace('\\', '')) if not r: r = re.search('"src"value="([^"]+)', js.replace('\\', '')) if not r: raise Exception( 'Unable to resolve Mightyupload link. Filelink not found.') return r.group(1) except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error', 'Http error: ' + str(e), 8000, error_logo) return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** Mightyupload Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]MIGHTYUPLOAD[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg='Exception: %s' % e)
class VidSpotResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidspot" domains = ["vidspot.net"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value html = self.net.http_POST(url, data).content r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) if r: fragment = r.group(1) stream_url = None for match in re.finditer('"file"\s*:\s*"([^"]+)', fragment): stream_url = match.group(1) if stream_url: return stream_url else: raise UrlResolver.ResolverError('could not find file') else: raise UrlResolver.ResolverError('could not find sources') def get_url(self, host, media_id): return 'http://vidspot.net/%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match( 'http://(www.)?vidspot.net/[0-9A-Za-z]+', url ) or re.match( 'http://(www.)?vidspot.net/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'vidspot' in host)
class PrimeshareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "primeshare" domains = ["primeshare.tv"] profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'primeshare.cookies') def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if re.search('>File not exist<', html): raise UrlResolver.ResolverError('File Not Found or removed') self.net.save_cookies(self.cookie_file) headers = {'Referer': web_url} # wait required common.addon.show_countdown(8) self.net.set_cookies(self.cookie_file) html = self.net.http_POST(web_url, form_data={ 'hash': media_id }, headers=headers).content r = re.compile("clip:.*?url: '([^']+)'", re.DOTALL).findall(html) if not r: r = re.compile("download\('([^']+)'", re.DOTALL).findall(html) if not r: raise UrlResolver.ResolverError( 'Unable to resolve Primeshare link. Filelink not found.') return r[0] def get_url(self, host, media_id): return 'http://primeshare.tv/download/%s' % (media_id) def get_host_and_id(self, url): r = re.search('http://(?:www.)(.+?)/download/([0-9A-Za-z]+)', url) if r: return r.groups() else: r = re.search('//(.+?)/download/([0-9A-Za-z]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.match('http://(www.)?primeshare.tv/download/[0-9A-Za-z]+', url) or 'primeshare' in host
class ClickNUploadResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "clicknupload" domains = ["clicknupload.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content tries = 0 while tries < MAX_TRIES: data = {} r = re.findall(r'type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html) for name, value in r: data[name] = value data['method_free'] = 'Free Download' data.update(captcha_lib.do_captcha(html)) headers = {'Referer': web_url} html = self.net.http_POST(web_url, data, headers=headers).content if tries > 0: xbmc.sleep(6000) if '>File Download Link Generated<' in html: r = re.search("onClick\s*=\s*\"window\.open\('([^']+)", html) if r: return r.group( 1) + '|User-Agent=%s' % (common.IE_USER_AGENT) tries = tries + 1 raise UrlResolver.ResolverError('Unable to locate link') def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search('//(.+?)/([0-9a-zA-Z/]+)', url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match( 'http://((?:www.)?clicknupload.com)/(?:f/)?([0-9A-Za-z]+)', url) or 'clicknupload' in host
class bayfilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "bayfiles" def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content found = re.search(r'var vfid = (\d+);\s*var delay = (\d+);', html) vfid, delay = found.groups() response = json.loads( self.net.http_POST('http://bayfiles.com/ajax_download', { "_": wait() * 1000, "action": "startTimer", "vfid": vfid }).content) common.addon.show_countdown( int(delay), '[B][COLOR orange]BAYFILES[/COLOR][/B]', '') html = self.net.http_POST('http://bayfiles.com/ajax_download', { "token": response['token'], "action": "getLink", "vfid": vfid }).content final_link = re.search( r"javascript:window.location.href = '([^']+)';", html) return final_link.group(1) except Exception, e: common.addon.log_error('**** Bayfiles Error occured: %s' % e) common.addon.show_small_popup( title='[B][COLOR white]BAYFILES[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e)
class VidSpotResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidspot" domains = ["vidspot.net"] pattern = '(?://|\.)(vidspot\.net)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() def get_media_url(self, host, media_id): url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value html = self.net.http_POST(url, data).content r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) if r: fragment = r.group(1) stream_url = None for match in re.finditer('"file"\s*:\s*"([^"]+)', fragment): stream_url = match.group(1) if stream_url: stream_url = '%s?%s&direct=false' % (stream_url.split( '?')[0], urlparse.urlparse(stream_url).query) return stream_url + '|' + urllib.urlencode( {'User-Agent': common.IE_USER_AGENT}) else: raise UrlResolver.ResolverError('could not find file') else: raise UrlResolver.ResolverError('could not find sources') def get_url(self, host, media_id): return 'http://vidspot.net/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class UploadXResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uploadx" domains = ["uploadx.org"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = '//((?:www.)?uploadx.org)/([0-9a-zA-Z/]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content tries = 0 while tries < MAX_TRIES: data = {} r = re.findall(r'type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html) for name, value in r: data[name] = value data['method_free'] = 'Free Download+>>' data.update(captcha_lib.do_captcha(html)) headers = { 'Referer': web_url } common.addon.log_debug(data) html = self.net.http_POST(web_url, data, headers=headers).content if tries > 0: xbmc.sleep(6000) if 'File Download Link Generated' in html: r = re.search('href="([^"]+)[^>]+id="downloadbtn"', html) if r: return r.group(1) + '|User-Agent=%s' % (common.IE_USER_AGENT) tries = tries + 1 raise UrlResolver.ResolverError('Unable to locate link') def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host