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


Python net.Net类代码示例

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


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

示例1: AllmyvideosResolver

class AllmyvideosResolver(Plugin,UrlResolver,PluginSettings):
    implements=[UrlResolver,PluginSettings]
    name="allmyvideos"
    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:
            url=self.get_url1st(host,media_id)
            headers={'User-Agent':USER_AGENT,'Referer':url}
            html=self.net.http_GET(url,headers=headers).content
            stream_url = self.__get_best_source(html) 
            if stream_url:
                xbmc.sleep(2000)
                return stream_url
            
            url=self.get_url(host,media_id)
            headers={'User-Agent':USER_AGENT,'Referer':url}
            html=self.net.http_GET(url,headers=headers).content
            
            data={}; r=re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">',html)
            for name,value in r: data[name]=value
            html=net.http_POST(url,data,headers=headers).content
            
            stream_url = self.__get_best_source(html) 
            if stream_url:
                xbmc.sleep(2000)
                return stream_url
            
            raise Exception('could not find video')          
        except Exception, e:
            common.addon.log('**** Allmyvideos Error occured: %s' % e)
            return self.unresolvable(code=0, msg='Exception: %s' % e)
开发者ID:SNAPflix,项目名称:script.module.urlresolver,代码行数:35,代码来源:allmyvideos.py

示例2: install_metapack

def install_metapack(pack):
	packs = metapacks.list()
	pack_details = packs[pack]
	mc = metacontainers.MetaContainer()
	work_path  = mc.work_path
	cache_path = mc.cache_path
	zip = os.path.join(work_path, pack)

	net = Net()
	cookiejar = ADDON.get_profile()
	cookiejar = os.path.join(cookiejar,'cookies')

	html = net.http_GET(pack_details[0]).content
	net.save_cookies(cookiejar)
	name = re.sub('-', r'\\\\u002D', pack)

	r = '"name": "%s".*?"id": "([^\s]*?)".*?"secure_prefix":"(.*?)",' % name
	r = re.search(r,html)
	pack_url  = 'http://i.minus.com'
	pack_url += r.group(2)
	pack_url += '/d' + r.group(1) + '.zip'

	complete = download_metapack(pack_url, zip, displayname=pack)
	extract_zip(zip, work_path)
	xbmc.sleep(5000)
	copy_meta_contents(work_path, cache_path)
	for table in mc.table_list:
		install = mc._insert_metadata(table)
开发者ID:zpanderson,项目名称:1Channel,代码行数:28,代码来源:default.py

示例3: SharedsxResolver

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)
开发者ID:Lynx187,项目名称:script.module.urlresolver,代码行数:60,代码来源:sharedsx.py

示例4: Mp4EdgeResolver

class Mp4EdgeResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mp4edge.com"
    domains = ["mp4edge.com"]
    
    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:.*?)mp4edge\.com)/stream/([0-9a-zA-Z]+)'
        self.user_agent = common.IE_USER_AGENT
        self.net.set_user_agent(self.user_agent)
        self.headers = {'User-Agent': self.user_agent}

    def get_url(self, host, media_id):
        return 'http://%s/stream/%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):
        if self.get_setting('enabled') == 'false': return False
        return re.match(self.pattern, url) or host in self.domains
    
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        html = self.net.http_GET(web_url, headers=self.headers).content
        r = re.search('file\s*:\s*["\'](.+?)["\']', html)
        if r:
            return r.group(1)
        else:
            raise UrlResolver.ResolverError('File not found')
开发者ID:msports,项目名称:mw,代码行数:35,代码来源:mp4edge.py

示例5: MightyuploadResolver

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
开发者ID:Lynx187,项目名称:script.module.urlresolver,代码行数:60,代码来源:mightyupload.py

示例6: CyberlockerResolver

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)
开发者ID:waggy162512,项目名称:script.module.urlresolver,代码行数:60,代码来源:cyberlocker.py

示例7: AllVidResolver

class AllVidResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "allvid"
    domains = ["allvid.ch"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://(allvid\.ch)/(?:embed-)(.+?)(?:-|/|\.|$)'
        self.user_agent = common.IE_USER_AGENT
        self.net.set_user_agent(self.user_agent)
        self.headers = {'User-Agent': self.user_agent}

    def get_url(self, host, media_id):
        return 'http://%s/embed-%s.html' % (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.match(self.pattern, url) or host in self.domains

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        html = self.net.http_GET(web_url, headers=self.headers).content
        r = re.search('sources\s*:\s*\[\s*\{\s*file\s*:\s*["\'](.+?)["\']', html)
        if r:
            return r.group(1)
        else:
            raise UrlResolver.ResolverError('File not found')
开发者ID:waggy162512,项目名称:script.module.urlresolver,代码行数:34,代码来源:allvid.py

示例8: download

def download(url,name):

    legendasOn = False

    if 'serie.php' in url:
        siteBase = 'serie.php'
    elif 'filme.php' in url:
        siteBase = 'filme.php'

    net = Net()
    net.set_cookies(__COOKIE_FILE__)
    codigo_fonte = net.http_GET(url, headers=__HEADERS__).content

    match = re.compile('<a class="btn" href="(.+?)"><img src="(.+?)"><\/a>').findall(codigo_fonte)

    stream, legenda = getStreamLegenda(match, siteBase, codigo_fonte)


    folder = xbmc.translatePath(__ADDON__.getSetting('pastaDownloads'))
    
    streamAux = clean(stream.split('/')[-1])
    extensaoStream = clean(streamAux.split('.')[1])
    name = name+'.'+extensaoStream


    if legenda != '':
        legendaAux = clean(legenda.split('/')[-1])
        extensaoLegenda = clean(legendaAux.split('.')[1])
        nomeLegenda = name+'.'+extensaoLegenda
        legendasOn = True

    Downloader.Downloader().download( os.path.join(folder,name), stream, name)

    if legendasOn:
        download_legendas(legenda, os.path.join(folder,nomeLegenda))
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:35,代码来源:addon.py

示例9: getListOfMyAccount

def getListOfMyAccount(url, pagina):
    net = Net()
    net.set_cookies(__COOKIE_FILE__)
    codigo_fonte = net.http_GET(url, headers=__HEADERS__).content
    

    match = re.compile('<div id="5" class="item">\s+<a href="(.+?)">\s+<img src="(.+?)" alt="(.+?)" title="(.+?)">').findall(codigo_fonte)

    if 'favoritos.php' in url:
        tipo = 'kodi_favoritos'
    elif 'agendados.php' in url:
        tipo = 'agendados'
    elif 'vistos.php' in url:
        tipo = 'vistos'

    pprint.pprint(match) 

    for link, imagem, nome, nome1 in match:
        if 'filme.php' in link:
            infoLabels = {'Title': nome.encode('utf8') }
            addVideo(nome.encode('utf8'), __SITE__+"kodi_"+link, 3, imagem, 'filme', 0, 0, infoLabels, imagem)
        elif 'serie.php' in link:
            infoLabels = {'Title': nome.encode('utf8')}
            addDir(nome.encode('utf8'), __SITE__+"kodi_"+link, 4, imagem, pagina, 'serie', infoLabels, imagem)
    
    
    addDir('Proximo', __SITE__+tipo+'.php?pagina='+str(int(pagina)+1), 11, os.path.join(__ART_FOLDER__, __SKIN__, 'proximo.png'), int(pagina)+1)

    vista_filmesSeries()
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:29,代码来源:addon.py

示例10: PutlockerResolver

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,代码行数:60,代码来源:putlocker.py

示例11: getEpisodes

def getEpisodes(url):

    net = Net()
    net.set_cookies(__COOKIE_FILE__)
    codigo_fonte = net.http_GET(url, headers=__HEADERS__).content


    match = re.compile('<div id="(.+?)" class="item">\s+<div class="thumb(.+?)?">\s+<a name=\'.+?\' href="(.+?)">\s+<img style="(.+?)" src="(.+?)" onError="this\.onerror=null;this\.src=\'(.+?)\';"\s+alt="(.+?)?">\s+<div class="thumb-shadow" alt="(.+?)?"><\/div>\s+<div class="thumb-effect" alt="(.+?)?"><\/div>\s+<div class="episode-number">(.+?)<\/div>').findall(codigo_fonte)

    temporadaNumero = re.compile('<div\s+class="season"><a\s+href="(.+?)"\s+class="slctd">(.+?)<\/a>').findall(codigo_fonte)[0][1]
    #actors = re.compile('<span class="director-caption">Elenco:<\/span>\s+<span class="director">(.+?)<\/span>').findall(codigo_fonte)[0]
    try:
        plot = re.compile(u'Descrição:<\/span>(.+\s.+)<\/span>\s+<\/div>').findall(codigo_fonte)[0]
    except:
        plot = "-"

    #criador = re.compile('<span class="director-caption">Criador: <\/span>\s+<span class="director">\s+(.+?)<\/span>').findall(codigo_fonte)[0]
    serieTitulo = re.compile('<span class="original-name">- "(.+?)"<\/span>').findall(codigo_fonte)[0].encode('utf8')

    for lixo, lixo1, link, lixo2, imagem, imagemExterna, nome, nome1, nome2, episodioNumero in match:
        imdb = re.compile('imdb=(.+?)&').findall(link)[0]
        #infoLabels = {'Title':nome.decode('utf8'), 'Actors':actors.decode('utf8'), 'Plot':plot.decode('utf8'), 'Season':temporadaNumero, 'Episode':episodioNumero, 'Writer': criador.decode('utf8'), "Code":imdb }
        infoLabels = {'Title': nome.decode('utf8'), 'Season':temporadaNumero, 'Episode': episodioNumero, "Code": imdb}
        if 'e' in episodioNumero:
            episodioNumeroReal = re.compile('(.+)e').findall(episodioNumero)[0]
        else:
            episodioNumeroReal = episodioNumero

        addVideo('[B]Episodio '+episodioNumero+'[/B] | '+nome.encode('utf8'), __SITE__+"kodi_"+link, 3, __SITE__+imagem, 'episodio', temporadaNumero, episodioNumeroReal, infoLabels, imagemExterna, serieTitulo)

    vista_episodios()
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:31,代码来源:addon.py

示例12: PlayedResolver

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,代码行数:33,代码来源:played.py

示例13: NovamovResolver

class NovamovResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "novamov"


    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)
        #find key
        r=None
        try:
            html = self.net.http_GET(web_url).content
            if 'nowvideo' in host:
                r = re.search('fkzd="(.+?)";\n\t\t\tflashvars.domain=".+?";\n\t\t\tflashvars.file="(.+?)";',html, re.DOTALL)
            elif 'novamov' in host:
                r = re.search('flashvars.file="(.+?)";\n\t\t\tflashvars.filekey="(.+?)";',html, re.DOTALL)

            print 'find key: '+str(r)
            if r:
                filekey, filename = r.groups()
                print "FILEBLOBS=%s  %s"%(filename,filekey)
            else:
                r = re.search('file no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')

            #get stream url from api
            if 'movshare' in host:
                api = 'http://www.movshare.net/api/player.api.php?key=%s&file=%s' % (filekey, filename)
            elif 'nowvideo' in host:
                api = 'http://www.nowvideo.eu/api/player.api.php?key=%s&file=%s' % (filekey, filename)
            elif 'novamov' in host:
                api = 'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filename, filekey)
            print api
            html = self.net.http_GET(api).content
        
            r = re.search('url=(.+?)&title', html)
            if r:
                stream_url = r.group(1)
                stream_url = re.sub('%3A',':',stream_url)
                stream_url = re.sub('%2F','/',stream_url)
            else:
                r = re.search('file no longer exists',html)
                if r:
                    raise Exception ('File Not Found or removed')
            
            return stream_url
        except urllib2.URLError, e:
            common.addon.log_error('Novamov: got http error %d fetching %s' %
                                    (e.code, web_url))
            return False
        except Exception, e:
            common.addon.log_error('**** Novamov Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]NOVAMOV[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return False
开发者ID:mablae,项目名称:script.module.urlresolver,代码行数:60,代码来源:novamov.py

示例14: PostContent

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')
开发者ID:ak0ng,项目名称:dk-xbmc-repaddon-rep,代码行数:26,代码来源:default.py

示例15: PromptfileResolver

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)
开发者ID:BagiraHun,项目名称:script.module.urlresolver,代码行数:35,代码来源:promptfile.py


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