コード例 #1
0
ファイル: Crawler.py プロジェクト: brainlezz/rockwurst
	def hits(self, url):
		self.conn.request("POST", "/search/" + url, self.params, self.headers)
		
		response = self.conn.getresponse().read().decode("windows-1252", errors="ignore")

		parser = HTMLPartsParser("tr", {"class" : ["first-line"]})
		parser.feed(response)

		return parser.matches
コード例 #2
0
ファイル: Currency.py プロジェクト: brainlezz/rockwurst
def updateCurrency(currencyId):
	html = getCurrencyHTML(currencyId)
	
	parser = HTMLPartsParser("div", {"class" : ["displayoffer-middle"]})
	parser.feed(html)
	
	matches = parser.matches
	
	if len(matches) > MAX_CURRENCY_COUNT_FOR_AVG:
		matches = matches[:MAX_CURRENCY_COUNT_FOR_AVG]
		
	sum = 0
	for match in matches:
		
		(to, chaos) = match.split("⇐")
		sum += float(chaos) / float(to)
		
	CURRENCYS[Currency(currencyId)] = sum / MAX_CURRENCY_COUNT_FOR_AVG