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


Python Net.set_cookies方法代码示例

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


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

示例1: noswifi

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [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

示例2: getListOfMyAccount

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
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,代码行数:31,代码来源:addon.py

示例3: getEpisodes

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
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,代码行数:33,代码来源:addon.py

示例4: download

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
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,代码行数:37,代码来源:addon.py

示例5: PutlockerResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [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

示例6: TVShowSeasonList

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def TVShowSeasonList(url, title, year, update=''): #4000
	print 'Seasons for TV Show %s' % url
	net = Net()
	cookiejar = ADDON.get_profile()
	cookiejar = os.path.join(cookiejar,'cookies')
	html = net.http_GET(url).content
	net.save_cookies(cookiejar)
	adultregex = '<div class="offensive_material">.+<a href="(.+)">I understand'
	r = re.search(adultregex, html, re.DOTALL)
	if r:
		print 'Adult content url detected'
		adulturl = BASE_URL + r.group(1)
		headers = {'Referer': url}
		net.set_cookies(cookiejar)
		html = net.http_GET(adulturl, headers=headers).content #.encode('utf-8', 'ignore')

	cnxn = sqlite.connect( DB )
	cnxn.text_factory = str
	cursor = cnxn.cursor()
	if year: title = title +'('+year+')'
	try:
		imdbnum = re.search('mlink_imdb">.+?href="http://www.imdb.com/title/(tt[0-9]{7})"', html).group(1)
	except: imdbnum = ''
	seasons = re.search('tv_container(.+?)<div class="clearer', html, re.DOTALL)
	if not seasons: ADDON.log_error('couldn\'t find seasons')
	else:
		season_container = seasons.group(1)
		season_nums = re.compile('<a href=".+?">Season ([0-9]{1,2})').findall(season_container)
		if imdbnum and META_ON == 'true': 
			metaget.update_meta('tvshow', title, imdbnum, year=year)
			season_meta = metaget.get_seasons(title, imdbnum, season_nums)
			if update:
				metaget.update_meta('tvshow', title, imdb_id='',
									new_imdb_id=imdbnum, year=year)
		seasonList = season_container.split('<h2>')
		num = 0
		temp = {}
		for eplist in seasonList:
			r = re.search('<a.+?>(.+?)</a>', eplist)
			if r:
				season_name = r.group(1)
				try: 	temp = season_meta[num]
				except: temp['cover_url'] = ''
				listitem = xbmcgui.ListItem(season_name, iconImage=temp['cover_url'], thumbnailImage=temp['cover_url'])
				listitem.setInfo(type="Video", infoLabels=temp)
				try: listitem.setProperty('fanart_image', temp['backdrop_url'])
				except: pass
				season_name = unicode_urlencode(season_name).lower()
				cursor.execute('INSERT or REPLACE into seasons (season,contents) VALUES(?,?);',
								(season_name, eplist))
				url = sys.argv[0]+ '?mode=5000'+'&season=' +season_name+ '&imdbnum='+imdbnum
				xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, 
											isFolder=True)
				cnxn.commit()
				num += 1
		setView('seasons', 'seasons-view')
		xbmcplugin.endOfDirectory(int(sys.argv[1]))
		cnxn.close()
开发者ID:zpanderson,项目名称:1Channel,代码行数:60,代码来源:default.py

示例7: karaokanta_GET

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def karaokanta_GET(name,url):      
        karaokanta_LOGIN()
        net.set_cookies(cookie_jar)
        html = net.http_GET(url).content
        match=re.compile('vID=(.+?)\.flv.+?><img src=.+?/>(.+?)<').findall(html)
        for URL ,name in match:
            name=name.replace('&nbsp;',' ')
            NAME=name.encode('utf-8')
            addDir(NAME,URL,203,'','none',1)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:11,代码来源:default.py

示例8: getList

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def getList(url, pagina):
    tipo = ''
    categoria = ''

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

    if 'kodi_filmes.php' in url:
        tipo = 'kodi_filmes'
    elif 'kodi_series.php' in url:
        tipo = 'kodi_series'
    elif 'kodi_animes.php' in url:
        tipo = 'kodi_animes'
        
    if 'categoria=' in url:
        categoria = re.compile('categoria=(.+[0-9])').findall(url)[0]

    #print codigo_fonte

    if tipo == 'kodi_filmes':
        match = re.compile('<img src="(.+?)" alt=".+?">\s+<\/a>\s+<\/div>\s+<\/div>\s+<div class="movie-info">\s+<a href="(.+?)" class="movie-name">.+?<\/a>\s+<div class="clear"><\/div>\s+<div class="movie-detailed-info">\s+<div class="detailed-aux" style="height\: inherit\;line-height\: 20px\;">\s+<span class="genre">(.+?)<\/span>\s+<span class="year">\s+<span>\(<\/span>(.+?)<span>\)<\/span><\/span>\s+<span class="original-name">\s+-\s+"(.+?)"<\/span>\s+<\/div>\s+<div class="detailed-aux">\s+<span class="director-caption">Realizador:\s+<\/span>\s+<span class="director">(.+?)<\/span>\s+<\/div>\s+<div class="detailed-aux">\s+<span class="director-caption">Elenco:<\/span>\s+<span class="director">(.+?)<\/span>\s+<\/div>\s+<\/div>\s+').findall(codigo_fonte)

    elif tipo == 'kodi_series':
        match = re.compile('<img src="(.+?)" alt=".+?">\s+<div class="thumb-effect" title=".+?"><\/div>\s+<\/a>\s+<\/div>\s+<\/div>\s+<div class="movie-info">\s+<a href="(.+?)" class="movie-name">.+?<\/a>\s+<div class="clear"><\/div>\s+<div class="movie-detailed-info">\s+<div class="detailed-aux" style="height\: 20px\; line-height\: 20px\;">\s+<span class="genre">(.+?)<\/span>\s+<span class="year">\s+<span>\(<\/span>(.+?)<span>\)<\/span><\/span>\s+<span class="original-name">\s+-\s+"(.+?)"<\/span>\s+<\/div>\s+<div class="detailed-aux">\s+<span class="director-caption">Criador:\s+<\/span>\s+<span class="director">(.+?)<\/span>\s+<\/div>\s+<div class="detailed-aux">\s+<span class="director-caption">Elenco:<\/span>\s+<span class="director">(.+?)<\/span>\s+<\/div>\s+<\/div>\s+').findall(codigo_fonte)
        
    elif tipo == 'kodi_animes':
        match = re.compile('<img src="(.+?)" alt=".+?">\s+<div class="thumb-effect" title=".+?"><\/div>\s+<\/a>\s+<\/div>\s+<\/div>\s+<div class="movie-info">\s+<a href="(.+?)" class="movie-name">.+?<\/a>\s+<div class="clear"><\/div>\s+<div class="movie-detailed-info">\s+<div class="detailed-aux" style="height\: 20px\; line-height\: 20px\;">\s+<span class="genre">(.+?)<\/span>\s+<span class="year">\s+<span>\(<\/span>(.+?)<span>\)<\/span><\/span>\s+<span class="original-name">\s+-\s+"(.+?)"<\/span>\s+<\/div>\s+<div class="detailed-aux">\s+<span class="director-caption">Criador:\s+<\/span>\s+<span class="director">(.+?)<\/span>\s+<\/div>\s+<div class="detailed-aux">\s+<span class="director-caption">Elenco:<\/span>\s+<span class="director">(.+?)<\/span>\s+<\/div>\s+<\/div>\s+').findall(codigo_fonte)

    #pprint.pprint(match)

    
    if tipo == 'kodi_filmes':

        for imagem, link, genero, ano, nomeOriginal, realizador, elenco in match:
            try:
                
                infoLabels = {'Title': nomeOriginal.decode('utf8'), 'Year': ano, 'Genre': genero.decode('utf8'), 'Plot': '' }

                addVideo(nomeOriginal+' ('+ano+')', __SITE__+"kodi_"+link, 3, imagem, 'filme', 0, 0, infoLabels, imagem)
            except:
                pass
    else:
        for imagem, link, genero, ano, nomeOriginal, realizador, elenco in match:
            try:
                infoLabels = {'Title':nomeOriginal.decode('utf8'), 'Aired':ano, 'Plot': ''}
                addDir(nomeOriginal+ ' ('+ano+')', __SITE__+"kodi_"+link, 4, imagem, pagina, 'serie', infoLabels, imagem)
            except:
                pass
            
    if categoria == '':
        addDir('Proximo', __SITE__+tipo+'.php?pagina='+str(int(pagina)+1), 1, os.path.join(__ART_FOLDER__, __SKIN__, 'proximo.png'), int(pagina)+1)
    else:
        addDir('Proximo', __SITE__+tipo+'.php?pagina='+str(int(pagina)+1)+'&categoria='+categoria, 1, os.path.join(__ART_FOLDER__, __SKIN__, 'proximo.png'), int(pagina)+1)

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

示例9: abrir_url_cookie

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def abrir_url_cookie(url):
      from t0mm0.common.net import Net
      net=Net()
      net.set_cookies(cookie_nos)
      try:
            link=net.http_GET(url).content.encode('latin-1','ignore')
            return link
      except urllib2.HTTPError, e:
            mensagemok('Hotspot Connector',str(urllib2.HTTPError(e.url, e.code, 'Erro a abrir página', e.hdrs, e.fp)),traducao(40200))
            sys.exit(0)
开发者ID:Thewallguy,项目名称:fightnight-addons,代码行数:12,代码来源:default.py

示例10: Search

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def Search(section, query, imdb):
    html = GetURL(BASE_URL)
    r = re.search('input type="hidden" name="key" value="([0-9a-f]*)"', html).group(1)
    search_url = BASE_URL + '/index.php?search_keywords='
    search_url += urllib.quote_plus(query)
    search_url += '&key=' + r
    if section == 'tv':
        search_url += '&search_section=2'
        video_type = 'tvshow'
    else:
        video_type = 'movie'

    html = GetURL(search_url)

    r = 'class="index_item.+?href="(.+?)" title="Watch (.+?)"?\(?([0-9]{4})?\)?"?>.+?src="(.+?)"'
    regex = re.search(r, html, re.DOTALL)
    if regex:
        url,title,year,thumb = regex.groups()
        net = Net()
        cookiejar = addon.get_profile()
        cookiejar = os.path.join(cookiejar,'cookies')
        net.set_cookies(cookiejar)
        html = net.http_GET(BASE_URL + url).content
        net.save_cookies(cookiejar)
        adultregex = '<div class="offensive_material">.+<a href="(.+)">I understand'
        r = re.search(adultregex, html, re.DOTALL)
        if r:
            addon.log('Adult content url detected')
            adulturl = BASE_URL + r.group(1)
            headers = {'Referer': url}
            net.set_cookies(cookiejar)
            html = net.http_GET(adulturl, headers=headers).content
            net.save_cookies(cookiejar)

        for version in re.finditer('<table[^\n]+?class="movie_version(?: movie_version_alt)?">(.*?)</table>',
                                    html, re.DOTALL|re.IGNORECASE):
            for s in re.finditer('quality_(?!sponsored|unknown)(.*?)></span>.*?'+
                                  'url=(.*?)&(?:amp;)?domain=(.*?)&(?:amp;)?(.*?)'+
                                 '"version_veiws"> ([\d]+) views</',
                                 version.group(1), re.DOTALL):
                q, url, host, parts, views = s.groups()
                q = q.upper()
                url = url.decode('base-64')
                host = host.decode('base-64')
                disp_title = '[%s] %s (%s views)' %(q, host, views)
                result = {'tag':tag, 'provider_name':display_name}
                qs = {'url':url, 'title':title, 'img':thumb, 'year':year, 'imdbnum':imdb}
                qs['video_type'] = video_type
                qs['strm'] = True
                qs['mode'] = 'PlaySource'
                result['li_url'] = 'plugin://plugin.video.1channel/?%s' %urllib.urlencode(qs)
                print result['li_url']
                result['info_labels'] = {'title':disp_title}
                yield result
开发者ID:rollysalvana,项目名称:pampereo-xbmc-plugins,代码行数:56,代码来源:1Channel_provider.py

示例11: abrir_url_cookie

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def abrir_url_cookie(url,parametros=None):
      from t0mm0.common.net import Net
      net=Net()
      net.set_cookies(cookie_wt)
      try:
            if parametros:link=net.http_POST(url,parametros).content.encode('latin-1','ignore')
            link=net.http_GET(url).content.encode('latin-1','ignore')
            return link
      except urllib2.HTTPError, e:
            mensagemok('wareztuga.tv',str(urllib2.HTTPError(e.url, e.code, traducao(40199), e.hdrs, e.fp)),traducao(40200))
            sys.exit(0)
开发者ID:KODeKarnage,项目名称:fightnight-addons,代码行数:13,代码来源:visto.py

示例12: EcostreamResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
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("anlytcs='([^']+)'", html)
            if not r:
                raise Exception ('Formvalue not found')
            part1 = r.group(1)
            r = re.search("superslots='([^']+)';", 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/vidureis'
            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)
开发者ID:TinyHTPC,项目名称:xbmc-packs,代码行数:56,代码来源:ecostream.py

示例13: abrir_url_cookie

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def abrir_url_cookie(url,erro=True):
      from t0mm0.common.net import Net
      net=Net()
      net.set_cookies(cookies)
      try:
            ref_data = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','Connection':'keep-alive','Host':'www.docspt.com','User-Agent':user_agent}
            link=net.http_GET(url,ref_data).content.encode('latin-1','ignore')
            return link
      except urllib2.HTTPError, e:
            if erro==True: mensagemok('docsPT',str(urllib2.HTTPError(e.url, e.code, traducao(40032), e.hdrs, e.fp)),traducao(40033))
            sys.exit(0)
开发者ID:KODeKarnage,项目名称:fightnight-addons,代码行数:13,代码来源:default.py

示例14: loginAgora

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
def loginAgora():
	if (not __ADDON__.getSetting('login_name') or not __ADDON__.getSetting('login_password')):
		__ALERTA__('Live!t TV', 'Precisa de definir o seu Utilizador e Senha')
		abrirDefinincoesMesmo()
	else:
		try:
			net = Net()
			net.set_cookies(__COOKIE_FILE__)
			dados = {'username': __ADDON__.getSetting("login_name"), 'password': __ADDON__.getSetting("login_password")}
			codigo_fonte = net.http_POST(base_server+'/PHP/LoginAddon2.php',form_data=dados,headers=__HEADERS__).content
			elems = ET.fromstring(codigo_fonte)
			
			servid = ''
			nomeus = ''
			tipous = ''
			sucesso = ''
			for child in elems:
				if(child.tag == 'sucesso'):
					sucesso = child.text
				elif(child.tag == 'user'):
					for d in child:
						if(d.tag == 'Nome'):
							nomeus = d.text
						elif(d.tag == 'Tipo'):
							tipous = d.text
						elif(d.tag == 'Servidor'):
							servid = d.text
			
			if sucesso == 'utilizador':
				__ALERTA__('Live!t TV', 'Utilizador incorreto.')
				__ADDON__.openSettings()
				addDir2('Entrar novamente', 'url', None, None, 'Miniatura', base_server+'/Addon/Imagens/retroceder.png','','','','',os.path.join(__ART_FOLDER__, __SKIN__, 'fundo_addon.png'))
				xbmc.executebuiltin("Container.SetViewMode(50)")
			elif sucesso == 'senha':
				__ALERTA__('Live!t TV', 'Senha incorreta.')
				__ADDON__.openSettings()
				addDir2('Entrar novamente', 'url', None, None, 'Miniatura', base_server+'/Addon/Imagens/retroceder.png','','','','',os.path.join(__ART_FOLDER__, __SKIN__, 'fundo_addon.png'))
				xbmc.executebuiltin("Container.SetViewMode(50)")
			elif sucesso == 'ativo':
				__ALERTA__('Live!t TV', 'O estado do seu Utilizador encontra-se Inactivo. Para saber mais informações entre em contacto pelo email [email protected]')
				xbmc.executebuiltin("Container.SetViewMode(50)")
			elif sucesso == 'yes':
				if servid == '':
					__ALERTA__('Live!t TV', 'Não foi possível abrir a página. Por favor tente novamente mais tarde.')
				elif servid == 'Teste':
					__ALERTA__('Live!t TV', 'O seu utilizador é um servidor de teste. Logo não pode instalar a Build. Adquira um pack através do site: http://liveitkodi.com/Aquisicao e após isso terá a sua conta e pode instalar a build.')
				else:
					xbmc.executebuiltin('Notification(%s, %s, %i, %s)'%('Live!t-TV','Secção Iniciada: '+nomeus, 8000, _ICON_))
					CATEGORIES()
			else:
				__ALERTA__('Live!t TV', 'Não foi possível abrir a página. Por favor tente novamente.')
		except:
			__ALERTA__('Live!t TV', 'Não foi possível abrir a página. Por favor tente novamente.')
开发者ID:antoniovsc,项目名称:liveit.repository,代码行数:55,代码来源:default.py

示例15: EcostreamResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import set_cookies [as 别名]
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)
            # emulate click on button "Start Stream"
            postHeader = {"Referer": web_url, "X-Requested-With": "XMLHttpRequest"}
            web_url = "http://www.ecostream.tv/xhr/video/get"
            self.net.set_cookies(self.cookie_file)
            html = self.net.http_POST(web_url, {"id": media_id}, 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)
开发者ID:pi3man,项目名称:script.module.urlresolver,代码行数:53,代码来源:ecostream.py


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