瀏覽代碼

Scraping steam discounts using beautiful soup

David Leonard 10 年之前
父節點
當前提交
e3c3bfc6de
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12 1
      hackathon_starter/hackathon/scripts/scraper.py

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

@@ -24,4 +24,15 @@ for name in gameName:
 	for tag in span:
 		gameNames.append(tag.text)
 
-print gameNames
+print gameNames
+
+discount = soup.findAll('div', {'class': 'col search_discount'})
+
+# Get all game discounts 
+gameDiscounts = []
+for discountedGame in discount:
+	span = discountedGame.findAll('span')
+	for tag in span:
+		gameDiscounts.append(tag.text)
+
+print gameDiscounts