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


Python client.downloadPage函数代码示例

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


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


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