소스 검색

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