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


Python Net.http_GET方法代码示例

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


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

示例1: VeohResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class VeohResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "veoh"

    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):
        html = self.net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse").content
        try:
            if not re.search('This video is not available on mobile', html):
                r = re.compile("watchNow\('(.+?)'").findall(html)
                if (len(r) > 0 ):
                    return r[0]

            url = 'http://www.veoh.com/rest/video/'+media_id+'/details'
            html = self.net.http_GET(url).content
            file = re.compile('fullPreviewHashPath="(.+?)"').findall(html)

            if len(file) == 0:
                raise Exception ('File Not Found or removed')

            return file[0]
        except urllib2.URLError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' %
                                   (e.code, web_url))
            common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo)
            return False
        except Exception, e:
            common.addon.log('**** Veoh Error occured: %s' % e)
            common.addon.show_small_popup(title='[B][COLOR white]VEOH[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
            return False
开发者ID:Hinnak321,项目名称:script.module.urlresolver,代码行数:36,代码来源:veoh.py

示例2: VidxdenResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class VidxdenResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "vidxden"

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        """ Human Verification """

        try:
            resp = self.net.http_GET(web_url)
            html = resp.content
            try: os.remove(img)
            except: pass
            try:
                filename=re.compile('<input name="fname" type="hidden" value="(.+?)">').findall(html)[0]
                noscript=re.compile('<iframe src="(.+?)"').findall(html)[0]
                check = self.net.http_GET(noscript).content
                hugekey=re.compile('id="adcopy_challenge" value="(.+?)">').findall(check)[0]
                headers= {'User-Agent':'Mozilla/6.0 (Macintosh; I; Intel Mac OS X 11_7_9; de-LI; rv:1.9b4) Gecko/2012010317 Firefox/10.0a4',
                         'Host':'api.solvemedia.com','Referer':resp.get_url(),'Accept':'image/png,image/*;q=0.8,*/*;q=0.5'}
                open(img, 'wb').write( self.net.http_GET("http://api.solvemedia.com%s"%re.compile('<img src="(.+?)"').findall(check)[0]).content)
                solver = InputWindow(captcha=img)
                puzzle = solver.get()
                if puzzle:
                    data={'adcopy_response':urllib.quote_plus(puzzle),'adcopy_challenge':hugekey,'op':'download1','method_free':'1','usr_login':'','id':media_id,'fname':filename}
                    html = self.net.http_POST(resp.get_url(),data).content
            except Exception, e:
                print e
                xbmc.executebuiltin('XBMC.Notification([B][COLOR white]VIDXDEN[/COLOR][/B],[COLOR red]No such file or the file has been removed due to copyright infringement issues[/COLOR],2500,'+logo+')')
                pass
        except urllib2.URLError, e:
            common.addon.log_error('vidxden: got http error %d fetching %s' %
                                  (e.code, web_url))
            return False
       
        #find packed javascript embed code
        r = re.search('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split',html)
        if r:
            p, k = r.groups()
        else:
            common.addon.log_error('vidxden: packed javascript embed code not found')
        try: decrypted_data = unpack_js(p, k)
        except: pass
        
        #First checks for a flv url, then the if statement is for the avi url
        r = re.search('file.\',.\'(.+?).\'', decrypted_data)
        if not r:
            r = re.search('src="(.+?)"', decrypted_data)
        if r:
            stream_url = r.group(1)
        else:
            common.addon.log_error('vidxden: stream url not found')
            return False

        return "%s|User-Agent=%s"%(stream_url,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0')
开发者ID:Tobie889900,项目名称:script.module.urlresolver,代码行数:62,代码来源:vidxden.py

示例3: NosvideoResolver

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

示例4: NovamovResolver

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

示例5: MightyuploadResolver

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

示例6: VeohResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class VeohResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "veoh"

    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):
        print 'veoh resolver: in get_media_url'
        print 'host %s media_id %s' %(host, media_id)

        html = self.net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse").content
        if not re.search('This video is not available on mobile', html):
            r = re.compile("watchNow\('(.+?)'").findall(html)
            if (len(r) > 0 ):
                return r[0]

        url = 'http://www.veoh.com/rest/video/'+media_id+'/details'
        print 'url is %s' %url
        html = self.net.http_GET(url).content
        file = re.compile('fullPreviewHashPath="(.+?)"').findall(html)

        if len(file) == 0:
            print 'coult not obtain video url'
            return False

        print 'video link is %s' % file[0]
        return file[0]

    def get_url(self, host, media_id):
        return 'http://veoh.com/watch/%s' % media_id


    def get_host_and_id(self, url):
        r = None
        video_id = None
        print 'veoh resolver: in get_host_and_id %s ' % url
        if re.search('permalinkId=', url):
            r = re.compile('veoh.com.+?permalinkId=(\w+)&*.*$').findall(url)
        elif re.search('watch/', url):
            r = re.compile('watch/(.+)').findall(url)
            
        if r is not None and len(r) > 0:
            video_id = r[0]
        if video_id:
            return ('veoh.com', video_id)
        else:
            common.addon.log_error('veoh: video id not found')
            return False

    def valid_url(self, url, host):
        return re.search('www.veoh.com/watch/.+',url) or re.search('www.veoh.com/.+?permalinkId=.+',url) or 'veoh' in host

    def get_settings_xml(self):
        xml = PluginSettings.get_settings_xml(self)
        xml += '<setting label="This plugin calls the veoh addon - '
        xml += 'change settings there." type="lsep" />\n'
        return xml
开发者ID:070499,项目名称:xbmc-addons,代码行数:62,代码来源:veoh.py

示例7: AllmyvideosResolver

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

示例8: FlashxResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class FlashxResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "flashx"
    domains = ["flashx.tv"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.pattern = 'http://((?:www.|play.)?flashx.tv)/(?:embed-)?([0-9a-zA-Z/-]+)(?:.html)?'

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url}
        smil = ''
        try:
            html = self.net.http_GET(web_url, headers=headers).content
            swfurl = 'http://static.flashx.tv/player6/jwplayer.flash.swf'
            r = re.search('"(http://.+?\.smil)"', html)
            if r: smil = r.group(1)
            else:
                r = re.search('\|smil\|(.+?)\|sources\|', html)
                if r: smil = 'http://flashx.tv/' + r.group(1) + '.smil'
            if smil:
                html = self.net.http_GET(smil, headers=headers).content
                r = re.search('<meta base="(rtmp://.*?flashx\.tv:[0-9]+/)(.+/)".*/>', html, re.DOTALL)
                if r:
                    rtmp = r.group(1)
                    app = r.group(2)
                    sources = re.compile('<video src="(.+?)" height="(.+?)" system-bitrate="(.+?)" width="(.+?)".*/>').findall(html)
                    vid_list = []
                    url_list = []
                    best = 0
                    quality = 0
                    if sources:
                        if len(sources) > 1:
                            for index, video in enumerate(sources):
                                if int(video[1]) > quality: best = index
                                quality = int(video[1])
                                vid_list.extend(['FlashX - %sp' % quality])
                                url_list.extend([video[0]])
                    if len(sources) == 1: vid_sel = sources[0][0]
                    else:
                        if self.get_setting('auto_pick') == 'true': vid_sel = url_list[best]
                        else:
                            result = xbmcgui.Dialog().select('Choose a link', vid_list)
                            if result != -1: vid_sel = url_list[result]
                            else: return self.unresolvable(code=0, msg='No link selected')

                    if vid_sel: return '%s app=%s playpath=%s swfUrl=%s pageUrl=%s swfVfy=true' % (rtmp, app, vid_sel, swfurl, web_url)

            raise Exception('File not found')

        except urllib2.URLError, e:
            common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.reason, web_url))
            return self.unresolvable(code=3, msg=e)
        
        except Exception, e:
            common.addon.log_error(self.name + ': general error occured: %s' % e)
            return self.unresolvable(code=0, msg=e)
开发者ID:VioletRed,项目名称:script.module.urlresolver,代码行数:62,代码来源:flashx.py

示例9: TVShowSeasonList

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

示例10: NosvideoResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class NosvideoResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "nosvideo"
    domains = ["nosvideo.com", "noslocker.com"]
    pattern = '(?://|\.)(nosvideo.com|noslocker.com)/(?:\?v\=|embed/|.+?\u=)?([0-9a-zA-Z]+)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content

        if 'File Not Found' in html:
            raise UrlResolver.ResolverError('File Not Found')

        r = re.search('class\s*=\s*[\'|\"]btn.+?[\'|\"]\s+href\s*=\s*[\'|\"](.+?)[\'|\"]', html)
        if not r:
            raise UrlResolver.ResolverError('File Not Found')

        headers = { 'Referer': r.group(1) }

        web_url = 'http://nosvideo.com/vj/video.php?u=%s&w=&h=530' % media_id

        html = self.net.http_GET(web_url, headers=headers).content

        stream_url = re.compile('var\stracker\s*=\s*[\'|\"](.+?)[\'|\"]').findall(html)
        stream_url += re.compile("tracker *: *[\'|\"](.+?)[\'|\"]").findall(html)

        if len(stream_url) > 0:
            stream_url = stream_url[0]
        else:
            raise UrlResolver.ResolverError('Unable to locate video file')

        try: stream_url = base64.b64decode(stream_url)
        except: pass

        stream_url += '|' + urllib.urlencode({ 'User-Agent': common.IE_USER_AGENT })

        return stream_url
 
    def get_url(self, host, media_id):
        return 'http://nosvideo.com/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False
    
    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
开发者ID:MrEntertainment,项目名称:script.module.urlresolver,代码行数:58,代码来源:nosvideo.py

示例11: MailRuResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class MailRuResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "mail.ru"
    domains = ["mail.ru"]
    pattern = '//((?:videoapi.)?my\.mail\.ru)/+(?:videos/+embed/+)?([^/]+)/+([^/]+)/+(?:video/+)?(?:[^/]+)/+([a-zA-Z1-9]+)'

    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)
        web_url = re.findall("<a href=\"(.+?)\"", self.net.http_GET(web_url).content)[0]
        headers={'Referer':web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        match = re.search('"metaUrl"\s*:\s*"([^"]+)', html)
        videos = []
        if match:
            json_url = match.group(1)
            response = self.net.http_GET(json_url)
            html = response.content
            if html:
                js_data = json.loads(html)
                headers = dict(response._response.info().items())
                stream_url = ''
                best_quality = 0
                for video in js_data['videos']:
                    video_headers={}
                    if 'set-cookie' in headers:
                        cookie_key=re.findall("(video_key=[^;]+);", headers['set-cookie'])[0]
                        video_headers['Cookie'] = cookie_key
                    quality = video['key']
                    video_url = "%s|%s" % (video['url'], urllib.urlencode(video_headers))
                    videos.append((quality, video_url))

        if not len(videos):
            raise UrlResolver.ResolverError('No playable video found.')

        return sorted(videos, key=lambda x: x[0])[0][1]

    def get_url(self, host, media_id):
        mtype, user, media_id = media_id.split('|')
        return 'http://videoapi.my.mail.ru/videos/embed/%s/%s/st/%s.html' % (mtype, user, media_id)

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            host, mtype, user, media_id = r.groups()
            return host, '%s|%s|%s' % (mtype, user, media_id)
        else:
            return False

    def valid_url(self, url, host):
        if self.get_setting('enabled') == 'false': return False
        return re.search(self.pattern, url) or 'mail.ru' in host
开发者ID:DxCx,项目名称:script.module.urlresolver,代码行数:58,代码来源:mailru.py

示例12: Search

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

示例13: GetContent

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
def GetContent(url):
    try:
       net = Net()
       try:
            second_response = net.http_GET(url)
       except:
            second_response = net.http_GET(url.encode("utf-8"))
       return second_response.content
    except:
       d = xbmcgui.Dialog()
       d.ok(url,"Can't Connect to site",'Try again in a moment')
开发者ID:jhonyf,项目名称:dkodi,代码行数:13,代码来源:default.py

示例14: ZeroCastResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class ZeroCastResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "zerocast"
    domains = ["zerocast.tv"]
    pattern = '(?://|\.)(zerocast\.tv)/((?:embed|(?:channels/)*chan(?:nel)*)\.php\?.*(?:a=[0-9]+|chan=[a-zA-Z0-9]+).*)'

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.net = Net()
        self.user_agent = common.IE_USER_AGENT
        self.net.set_user_agent(self.user_agent)
        self.headers = {'User-Agent': self.user_agent}

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        stream_url = None
        if 'chan=' in web_url:
            html = self.net.http_GET(web_url, headers=self.headers).content
            r = re.search('<script\stype=[\'"]text/javascript[\'"]\ssrc=[\'"](.+?)[\'"]>', html)
            if r:
                web_url = r.group(1)
        r = re.search('.+?a=([0-9]+).+', web_url)
        if r:
            web_url = 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % r.group(1)
            html = self.net.http_GET(web_url, headers=self.headers).content
            r = re.search('file\s*:\s*["\'](.+?)["\']', html)
            if r:
                stream_url = r.group(1)
            else:
                r = re.search('curl\s*=\s*[\'"](.+?)[\'"]', html)
                if r:
                    try:
                        stream_url = r.group(1).decode('base64', 'strict')
                    except Exception:
                        raise UrlResolver.ResolverError('Failed to decode url')
        if stream_url:
            return stream_url
        else:
            raise UrlResolver.ResolverError('File not found')

    def get_url(self, host, media_id):
        return 'http://zerocast.tv/%s' % media_id

    def get_host_and_id(self, url):
        r = re.search(self.pattern, url)
        if r:
            return r.groups()
        else:
            return False

    def valid_url(self, url, host):
        return re.search(self.pattern, url) or self.name in host
开发者ID:MrEntertainment,项目名称:script.module.urlresolver,代码行数:56,代码来源:zerocast.py

示例15: AaaaSextvXResolver

# 需要导入模块: from t0mm0.common.net import Net [as 别名]
# 或者: from t0mm0.common.net.Net import http_GET [as 别名]
class AaaaSextvXResolver(Plugin, UrlResolver, PluginSettings):
    implements = [UrlResolver, PluginSettings]
    name = "si_sextvx"
    domains = ["sextvx.com"]

    def __init__(self):
        p = self.get_setting('priority') or 100
        self.priority = int(p)
        self.pattern = 'http://.*?(sextvx\.com/[a-zA-Z]{2})/(?:embed|video|stream)/([0-9]+?)(?:-|$|/.*)'
        self.net = Net()
        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' % (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 self.name in host

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url}
        html = self.net.http_GET(web_url, headers=self.headers).content
        # http://www.sextvx.com/flux?d=web.flv&s=3&p=4,7,5,8,9,475894
        r = re.search('.*?<div id="player" path="(.+?),.+?\.(.+?)".*?', html)
        if r:
            s = r.group(1)
            p = r.group(2).replace('/', ',')
            web_url = 'http://www.sextvx.com/flux?d=web.flv&s=' + s + '&p=' + p
            stream_url = self.net.http_GET(web_url, headers=headers).content
            if stream_url:
                return self.__add_headers_for_kodi(stream_url)
        raise UrlResolver.ResolverError('File not found')

    def __add_headers_for_kodi(self, url):
        _referer = urllib.quote_plus('http://%s/' % self.domains[0])
        _user_agent = urllib.quote_plus(self.net._user_agent)
        _connection_timeout = '60'
        _cookies = ''
        for _cookie in self.net._cj:
            _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value))
        if _cookies:
            return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \
                   (url, _referer, _user_agent, _connection_timeout, _cookies)
        else:
            return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \
                   (url, _referer, _user_agent, _connection_timeout)
开发者ID:bialagary,项目名称:mw,代码行数:56,代码来源:si_sextvx.py


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