• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python client.downloadPage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: IMDBquery

	def IMDBquery(self,string):
		print "[IMDBquery]"
		self["statusbar"].setText(_("IMDb Download completed"))

		self.html2utf8(open("/tmp/imdbquery.html", "r").read())

		self.generalinfos = self.generalinfomask.search(self.inhtml)

		if self.generalinfos:
			self.IMDBparse()
		else:
			if re.search("<title>(?:IMDb.{0,9}Search|IMDb Titelsuche)</title>", self.inhtml):
				searchresultmask = re.compile("<tr> <td.*?img src.*?>.*?<a href=\".*?/title/(tt\d{7,7})/\".*?>(.*?)</td>", re.DOTALL)
				searchresults = searchresultmask.finditer(self.inhtml)
				self.resultlist = [(self.htmltags.sub('',x.group(2)), x.group(1)) for x in searchresults]
				self["menu"].l.setList(self.resultlist)
				if len(self.resultlist) > 1:
					self.Page = 1
					self.showMenu()
				else:
					self["detailslabel"].setText(_("No IMDb match."))
					self["statusbar"].setText(_("No IMDb match."))
			else:
				splitpos = self.eventName.find('(')
				if splitpos > 0 and self.eventName.endswith(')'):
					self.eventName = self.eventName[splitpos+1:-1]
					self["statusbar"].setText(_("Re-Query IMDb: %s...") % (self.eventName))
					event_quoted = urllib.quote(self.eventName.decode('utf8').encode('latin-1','ignore'))
					localfile = "/tmp/imdbquery.html"
					fetchurl = "http://" + self.IMDBlanguage + "imdb.com/find?q=" + event_quoted + "&s=tt&site=aka"
					print "[IMDB] Downloading Query " + fetchurl + " to " + localfile
					downloadPage(fetchurl,localfile).addCallback(self.IMDBquery).addErrback(self.fetchFailed)
				else:
					self["detailslabel"].setText(_("IMDb query failed!"))
开发者ID:OpenVuPlus,项目名称:dvbapp-plugin,代码行数:34,代码来源:plugin.py


示例2: getOFDB

	def getOFDB(self):
		self.resetLabels()
		if self.eventName is "":
			s = self.session.nav.getCurrentService()
			info = s and s.info()
			event = info and info.getEvent(0) # 0 = now, 1 = next
			if event:
				self.eventName = event.getEventName()

		if self.eventName is not "":
			try:
				pos = self.eventName.index(" (")
				self.eventName=self.eventName[0:pos]
			except ValueError:
				pass
			if self.eventName[-3:] == "...":
				self.eventName = self.eventName[:-3]
			for article in ["The", "Der", "Die", "Das"]:
				if self.eventName[:4].capitalize() == article + " ":
					self.eventName = self.eventName[4:] + ", " + article
			
			self["statusbar"].setText(_("Query OFDb: %s...") % (self.eventName))
			try:
				self.eventName = urllib.quote(self.eventName)
			except:
				self.eventName = urllib.quote(self.eventName.decode('utf8').encode('ascii','ignore'))
			localfile = "/tmp/ofdbquery.html"
			fetchurl = "http://www.ofdb.de/view.php?page=suchergebnis&Kat=DTitel&SText=" + self.eventName
			print "[OFDb] Downloading Query " + fetchurl + " to " + localfile
			downloadPage(fetchurl,localfile).addCallback(self.OFDBquery).addErrback(self.fetchFailed)
		else:
			self["statusbar"].setText(_("Could't get Eventname"))
开发者ID:68foxboris,项目名称:enigma2-plugins,代码行数:32,代码来源:plugin.py


示例3: upgradeCB

 def upgradeCB(self, result = None):
     print "[UMMeteo] - upgrade:", result
     if result:
         print "\n[UMMeteo] - upgrade yes\n"
         downloadPage('http://e2.areq.eu.org/ummeteo/update.py',PluginPath + '/update.py').addCallback(self.goupCB).addErrback(self.errorUpdate)
     else:
         print "[UMMeteo] upgrade cancel\n"
开发者ID:areqq,项目名称:UMMeteoPL,代码行数:7,代码来源:Meteo.py


示例4: showDetails

	def showDetails(self):
		self["ratinglabel"].show()
		self["castlabel"].show()
		self["detailslabel"].show()

		if self.resultlist and self.Page == 0:
			link = self["menu"].getCurrent()[1]
			title = self["menu"].getCurrent()[0]
			self["statusbar"].setText(_("Re-Query OFDb: %s...") % (title))
			localfile = "/tmp/ofdbquery2.html"
			fetchurl = "http://www.ofdb.de/film/" + link
			print "[OFDb] downloading query " + fetchurl + " to " + localfile
			downloadPage(fetchurl,localfile).addCallback(self.OFDBquery2).addErrback(self.fetchFailed)
			self["menu"].hide()
			self.resetLabels()
			self.Page = 1

		if self.Page == 2:
			self["extralabel"].hide()
			self["poster"].show()
			if self.ratingstars > 0:
				self["starsbg"].show()
				self["stars"].show()
				self["stars"].setValue(self.ratingstars)

			self.Page = 1
开发者ID:68foxboris,项目名称:enigma2-plugins,代码行数:26,代码来源:plugin.py


示例5: get_xmlfile

	def get_xmlfile(self):
		if self.isServerOnline():
			xmlfile = "http://xml.weather.yahoo.com/forecastrss?w=%s&d=10&u=c" % config.plugins.yweather.weather_city.value
			downloadPage(xmlfile, "/tmp/yweather.xml").addCallback(self.downloadFinished).addErrback(self.downloadFailed)
		else:
			self["text_now"].text = _('weatherserver not respond')
			self.notdata = True
开发者ID:mickeyreg,项目名称:YWeather,代码行数:7,代码来源:plugin.py


示例6: downloadThumbnail

	def downloadThumbnail(self):
		thumbUrl = self.list[self.idx][3]
		if not thumbUrl.startswith("http://"):
			thumbUrl = "%s%s"%(MAIN_PAGE, thumbUrl)
		try:
			req = urllib2.Request(thumbUrl)
			url_handle = urllib2.urlopen(req)
			headers = url_handle.info()
			contentType = headers.getheader("content-type")
		except:
			contentType = None
		if contentType:
			if 'image/jpeg' in contentType:
				self.thumb = "/tmp/zdf.jpg"
			elif 'image/gif' in contentType:
				self.thumb = "/tmp/zdf.gif"
			elif 'image/png' in contentType:
				self.thumb = "/tmp/zdf.png"
			else:
				print "[ZDF Mediathek] Unknown thumbnail content-type:", contentType
				self.thumb = None
		else:
			self.thumb = None
		if self.thumb:
			downloadPage(thumbUrl, self.thumb).addCallback(self.downloadThumbnailCallback).addErrback(self.downloadThumbnailError)
		else:
			self.buildEntry(None)
开发者ID:13K-OMAR,项目名称:enigma2-plugins-sh4,代码行数:27,代码来源:plugin.py


示例7: get_xmlfile

	def get_xmlfile(self):
#		xmlfile = "http://weather.service.msn.com/data.aspx?weadegreetype=C&culture=ru-RU&weasearchstr=Moscow,Moscow-City,Russia&src=outlook"

		xmlfile = "http://weather.service.msn.com/data.aspx?weadegreetype=%s&culture=%s&weasearchstr=%s&src=outlook" % (self.degreetype, self.language, self.city)
		xmlfile1 = "http://weather.service.msn.com/data.aspx?weadegreetype=%s&culture=en-US&weasearchstr=%s&src=outlook" % (self.degreetype, self.city)
		downloadPage(xmlfile, "/tmp/weathermsn.xml").addCallback(self.downloadFinished).addErrback(self.downloadFailed)
		downloadPage(xmlfile1, "/tmp/weathermsn.xml").addCallback(self.downloadFinished).addErrback(self.downloadFailed)
开发者ID:Kisa12,项目名称:enigma2-plugins,代码行数:7,代码来源:plugin.py


示例8: buildList

	def buildList(self):
		if len(self.movies):
			movie = self.movies[0]
			thumbUrl = movie[4]
			try:
				req = urllib2.Request(thumbUrl)
				url_handle = urllib2.urlopen(req)
				headers = url_handle.info()
				contentType = headers.getheader("content-type")
			except:
				contentType = None
			if contentType:
				if 'image/jpeg' in contentType:
					self.thumb = "/tmp/ard.jpg"
				elif 'image/gif' in contentType:
					self.thumb = "/tmp/ard.gif"
				elif 'image/png' in contentType:
					self.thumb = "/tmp/ard.png"
				else:
					print "[ARD Mediathek] Unknown thumbnail content-type:", contentType
					self.thumb = None
			else:
				self.thumb = None
			if self.thumb:
				downloadPage(thumbUrl, self.thumb).addCallback(self.downloadThumbnailCallback).addErrback(self.downloadThumbnailError)
			else:
				self.buildEntry(None)
		else:
			self["list"].setList(self.listMovies)
			self.deactivateCacheDialog()
开发者ID:Blacksens,项目名称:enigma2-plugins,代码行数:30,代码来源:plugin.py


示例9: getCover

	def getCover(self, url):
		self.getCoverTimerStart()
		print "getCover:", url
		if url:
			downloadPage(url, self.COVER_PIC_PATH).addCallback(self.showCover).addErrback(self.dataErrorP)
		else:
			self.showCoverNone()
开发者ID:ALShalahi,项目名称:enigma2,代码行数:7,代码来源:coverhelper.py


示例10: mvidown

	def mvidown(self, stadt):
		downlink = "http://www.meinestadt.de/"+ stadt +"/bilder"
		downname = "/tmp/.stadtindex"
		stadd = stadt
		if fileExists(downname):
			os.system("rm -rf "+ downname)
		downloadPage(downlink, downname).addCallback(self.jpgdown, stadd).addErrback(self.error)
开发者ID:sklnet,项目名称:opennfr-enigma2,代码行数:7,代码来源:MC_WeatherInfo.py


示例11: GoogleImageCallback

	def GoogleImageCallback(self, result):
		global coverfiles
		if self.nextGoogle:
			self.currentGoogle = self.nextGoogle
			self.nextGoogle = None
			sendUrlCommand(self.currentGoogle, None, 10).addCallback(self.GoogleImageCallback).addErrback(self.Error)
			return
		self.currentGoogle = None
		foundPos = result.find("unescapedUrl\":\"")
		foundPos2 = result.find("\",\"url\":\"")
		if foundPos != -1 and foundPos2 != -1:
			url=result[foundPos+15:foundPos2]
			if len(url)>15:
				url= url.replace(" ", "%20")
				print "download url: %s " % url
				validurl = True
			else:
				validurl = False
				print "[SHOUTcast] invalid cover url or pictureformat!"
				if config.plugins.shoutcast.showcover.value:
					self["cover"].doHide()
			if validurl:
				self.currentcoverfile = (self.currentcoverfile + 1) % len(coverfiles)
				try:
					os.unlink(coverfiles[self.currentcoverfile-1])
				except:
					pass
				coverfile = coverfiles[self.currentcoverfile]
				print "[SHOUTcast] downloading cover from %s to %s" % (url, coverfile)
				downloadPage(url, coverfile).addCallback(self.coverDownloadFinished, coverfile).addErrback(self.coverDownloadFailed)
开发者ID:popazerty,项目名称:beyonwiz-4.1,代码行数:30,代码来源:plugin.py


示例12: downloadThumbnail

	def downloadThumbnail(self,thumbUrl):
		if thumbUrl is not None:
			thumbID = thumbUrl.rsplit("/",1)[1]
			thumbFile = None
			if not thumbUrl.startswith("http://"):
				thumbUrl = "%s%s"%(MAIN_PAGE, thumbUrl)
			try:
				req = urllib2.Request(thumbUrl)
				url_handle = urllib2.urlopen(req)
				headers = url_handle.info()
				contentType = headers.getheader("content-type")
			except:
				contentType = None

			if contentType:
				if 'image/jpeg' in contentType:
					thumbFile = "/tmp/" + thumbID + ".jpg"
				elif 'image/gif' in contentType:
					thumbID = None
				#	thumbFile = "/tmp/" + thumbID + ".gif"
				elif 'image/png' in contentType:
					thumbFile = "/tmp/" + thumbID + ".png"
				else:
					print "[ZDF Mediathek] Unknown thumbnail content-type:", contentType
			if thumbFile is not None:
				if (os_path.exists(thumbFile) == True): #already downloaded
					self.downloadThumbnailCallback(None, thumbFile, thumbID)
				else:
					if self.png_cache.get(thumbID, None) is None:
						downloadPage(thumbUrl, thumbFile).addCallback(self.downloadThumbnailCallback, thumbFile, thumbID).addErrback(self.downloadThumbnailError, thumbID)
					else:
						self.updateEntry(thumbID, thumbFile)
开发者ID:Haehnchen,项目名称:enigma2-plugins,代码行数:32,代码来源:plugin.py


示例13: getResults

	def getResults(self, data):
		data = data.replace('\/','')
		if config.plugins.tmdb.firsthit.value:
			# list = re.findall('"id":(.*?),.*?original_title":"(.*?)".*?"poster_path":"(.*?)".*?title":"(.*?)"', data, re.S)
			list = re.findall('.*?"poster_path":"(.*?)".*?"id":(.*?),.*?"original_title":"(.*?)".*?"title":"(.*?)"', data, re.S)			
			if list:
				for coverPath,id,otitle,title in list:
					url_cover = "http://image.tmdb.org/t/p/%s/%s" % (config.plugins.tmdb.themoviedb_coversize.value, coverPath)
					url = "http://api.themoviedb.org/3/movie/%s?api_key=8789cfd3fbab7dccf1269c3d7d867aff&append_to_response=releases,trailers,casts&language=%s" % (id, config.plugins.tmdb.lang.value)
					cover = self.tempDir+id+".jpg"
					downloadPage(url_cover, cover).addCallback(self.openMovie, title, url, cover, id).addErrback(self.dataError)
					break
			else:
				print "[TMDb] no movie found."
				self['searchinfo'].setText(_("No Movie information found for %s") % self.text)
		else:
			urls = []
			# list = re.findall('"id":(.*?),.*?original_title":"(.*?)".*?"poster_path":"(.*?)".*?title":"(.*?)"', data, re.S)
			list = re.findall('.*?"poster_path":"(.*?)".*?"id":(.*?),.*?"original_title":"(.*?)".*?"title":"(.*?)"', data, re.S)

			if list:
				for coverPath,id,otitle,title in list:
					url_cover = "http://image.tmdb.org/t/p/%s/%s" % (config.plugins.tmdb.themoviedb_coversize.value, coverPath)
					url = "http://api.themoviedb.org/3/movie/%s?api_key=8789cfd3fbab7dccf1269c3d7d867aff&append_to_response=releases,trailers,casts&language=%s" % (id, config.plugins.tmdb.lang.value)
					#print "[tmbd] " + title, url_cover, "\n", url
					urls.append(((title, url_cover, url, id),))
				self['list'].setList(urls)
				self.getInfo()
			else:
				print "[TMDb] no movie found."
				self['searchinfo'].setText(_("No Movie information found for %s") % self.text)
开发者ID:TomTelos,项目名称:TMDb,代码行数:31,代码来源:tmdb.py


示例14: getTempCover

def getTempCover(posterUrl):
	if posterUrl is not None and config.EMC.movieinfo.coversave.value:
		try:
			coverpath = "/tmp/previewCover.jpg"
			url = "http://image.tmdb.org/t/p/%s%s" % (config.EMC.movieinfo.coversize.value, posterUrl)
			downloadPage(url, coverpath).addErrback(dataError)
		except Exception, e:
			print('[EMC] MovieInfo getTempCover exception failure: ', str(e))
开发者ID:sunder67,项目名称:e2openplugin-EnhancedMovieCenter,代码行数:8,代码来源:MovieInfo.py


示例15: loadThumbnail

	def loadThumbnail(self, index, callback):
		print "[YTB] YouTubeEntry::loadThumbnail()"
		thumbnailUrl = self.getThumbnailUrl(index)
		if thumbnailUrl is not None and self.getYouTubeId() is not None:
			thumbnailFile = "/tmp/" + self.getYouTubeId() + "_" + str(index) + ".jpg"
			self.thumbnail[str(index)] = None
			cookie = {"entry" : self, "file" : thumbnailFile, "callback" : callback, "index" : index}
			downloadPage(thumbnailUrl, thumbnailFile).addCallback(fetchFinished, cookie).addErrback(fetchFailed, cookie)
开发者ID:13K-OMAR,项目名称:enigma2-plugins-sh4,代码行数:8,代码来源:YouTubeInterface.py


示例16: getInfo

	def getInfo(self):
		url_cover = self['list'].getCurrent()[1]
		id = self['list'].getCurrent()[3]
		
		if not fileExists(self.tempDir+id+".jpg"):
			downloadPage(url_cover, self.tempDir+id+".jpg").addCallback(self.getData, self.tempDir+id+".jpg").addErrback(self.dataError)
		else:
			self.showCover(self.tempDir+id+".jpg")
开发者ID:TomTelos,项目名称:TMDb,代码行数:8,代码来源:tmdb.py


示例17: createPictures

	def createPictures(self, content):
		for entry in content:
			if entry[1]:
				image = entry[1].rsplit('/', 1)[1]
				if image not in self.pictures:
					image = os.path.join('/tmp/', image)
					downloadPage(entry[1], image)\
							.addCallback(boundFunction(self.downloadFinished, image))\
							.addErrback(boundFunction(self.downloadFailed, image))
开发者ID:Taapat,项目名称:enigma2-plugin-mtgplay,代码行数:9,代码来源:MTGPlay.py


示例18: __init__

 def __init__(self, session, image, captchaCB, dest='/tmp/captcha.png'):
     self.session = session
     self.captchaCB = captchaCB
     self.dest = dest
     
     if os.path.isfile(image):
         self.openCaptchaDialog(image)
     else:
         downloadPage(image, dest).addCallback(self.downloadCaptchaCB).addErrback(self.downloadCaptchaError)
开发者ID:easyspider,项目名称:archivczsk,代码行数:9,代码来源:captcha.py


示例19: _download

  def _download(base, ongoing):
    path = os.path.join(base, ongoing['path'])
    _ensure_dir(path)

    fullname = os.path.join(path, ongoing['name']).encode('utf-8')
    url      = ongoing['url'].encode('utf-8')

    downloadPage(url, fullname).addCallbacks(
        cbDownloaded, cbErrorDownload, callbackArgs=[base, ongoing], errbackArgs=[base, ongoing])
开发者ID:ruslansv,项目名称:sin,代码行数:9,代码来源:sin_agent.py


示例20: do_download

	def do_download(self, sourcefile, afterDownload, downloadFail):
		path = bigStorage(9000000, '/tmp', '/media/cf', '/media/usb', '/media/hdd')
		filename = os.path.join(path, 'epgimport')
		if sourcefile.endswith('.gz'):
			filename += '.gz'
		sourcefile = sourcefile.encode('utf-8')
		print>>log, "[EPGImport] Downloading: " + sourcefile + " to local path: " + filename
		downloadPage(sourcefile, filename).addCallbacks(afterDownload, downloadFail, callbackArgs=(filename,True))
		return filename
开发者ID:azamajmal,项目名称:enigma2-plugin-extensions-xmltvimport,代码行数:9,代码来源:EPGImport.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python client.getPage函数代码示例发布时间:2022-05-27
下一篇:
Python client._parse函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap