scraper.py 934 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import requests
  2. from bs4 import BeautifulSoup
  3. req = requests.get('http://store.steampowered.com/search/?specials=1#sort_by=_ASC&sort_order=ASC&specials=1&page=1')
  4. content = req.text
  5. soup = BeautifulSoup(content)
  6. # Get all divs of a specific class
  7. releaseDate = soup.findAll('div', {'class': 'col search_released'})
  8. # Get all release dates
  9. releaseDates = []
  10. for date in releaseDate:
  11. releaseDates.append(date.text)
  12. print releaseDates
  13. gameName = soup.findAll('div', {'class': 'col search_name ellipsis'})
  14. # Get all game names
  15. gameNames = []
  16. for name in gameName:
  17. span = name.findAll('span', {'class': 'title'})
  18. for tag in span:
  19. gameNames.append(tag.text)
  20. print gameNames
  21. discount = soup.findAll('div', {'class': 'col search_discount'})
  22. # Get all game discounts
  23. gameDiscounts = []
  24. for discountedGame in discount:
  25. span = discountedGame.findAll('span')
  26. for tag in span:
  27. gameDiscounts.append(tag.text)
  28. print gameDiscounts