当前位置: 首页>>代码示例>>Python>>正文


Python Net.http_POST方法代码示例

本文整理汇总了Python中t0mm0.common.net.Net.http_POST方法的典型用法代码示例。如果您正苦于以下问题:Python Net.http_POST方法的具体用法?Python Net.http_POST怎么用?Python Net.http_POST使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在t0mm0.common.net.Net的用法示例。


在下文中一共展示了Net.http_POST方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: bayfilesResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:Hinnak321,项目名称:script.module.urlresolver,代码行数:35,代码来源:bayfiles.py

示例2: TheFileResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:VioletRed,项目名称:script.module.urlresolver,代码行数:61,代码来源:thefile.py

示例3: EcostreamResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:knipser88,项目名称:script.module.urlresolver,代码行数:58,代码来源:ecostream.py

示例4: LISTINT3

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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")
开发者ID:marduk191,项目名称:plugin.video.movie25,代码行数:58,代码来源:cinevip.py

示例5: analyzer

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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
开发者ID:Thewallguy,项目名称:fightnight-addons,代码行数:53,代码来源:default.py

示例6: login_abelhas

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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()
开发者ID:Thewallguy,项目名称:fightnight-addons,代码行数:51,代码来源:default.py

示例7: PlayedResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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
开发者ID:Lynx187,项目名称:script.module.urlresolver,代码行数:35,代码来源:played.py

示例8: playedResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:Ddubs,项目名称:infinitytv_kodi,代码行数:28,代码来源:played.py

示例9: noswifi

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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: " + str(html)

            m = re.search('<div class="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
开发者ID:Thewallguy,项目名称:fightnight-addons,代码行数:36,代码来源:default.py

示例10: NosvideoResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:Vodzo,项目名称:script.module.urlresolver,代码行数:62,代码来源:nosvideo.py

示例11: FilenukeResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:BagiraHun,项目名称:script.module.urlresolver,代码行数:62,代码来源:filenuke.py

示例12: UfliqResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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
开发者ID:CelticShady,项目名称:script.module.urlresolver,代码行数:37,代码来源:ufliq.py

示例13: PutlockerResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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:
开发者ID:TheYid,项目名称:script.module.urlresolver,代码行数:62,代码来源:putlocker.py

示例14: watchfreeResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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)
开发者ID:CelticShady,项目名称:script.module.urlresolver,代码行数:34,代码来源:watchfreeinhd.py

示例15: login_docspt

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_POST [as 别名]
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()                
开发者ID:KODeKarnage,项目名称:fightnight-addons,代码行数:37,代码来源:default.py


注:本文中的t0mm0.common.net.Net.http_POST方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。