浏览代码

Scraping steam discounted prices using beautiful soup

David Leonard 10 年之前
父节点
当前提交
99ce05df8b
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      hackathon_starter/hackathon/scripts/scraper.py

+ 12 - 1
hackathon_starter/hackathon/scripts/scraper.py

@@ -35,4 +35,15 @@ for discountedGame in discount:
 	for tag in span:
 		gameDiscounts.append(tag.text)
 
-print gameDiscounts
+print gameDiscounts
+
+price = soup.findAll('div', {'class': 'col search_price discounted'})
+
+prices = []
+# Get all discounted prices
+for value in price:
+	br = value.findAll('br')
+	for tag in br:
+		prices.append(tag.text.strip('\t'))
+
+print prices