Skip to content

Instantly share code, notes, and snippets.

@SliceOLife
Last active May 19, 2016 04:51
Show Gist options
  • Save SliceOLife/47ef1709f57ced5147d7 to your computer and use it in GitHub Desktop.
Save SliceOLife/47ef1709f57ced5147d7 to your computer and use it in GitHub Desktop.
Checks Origin's on the House page for free games.
import requests
import bs4
from termcolor import colored
root_url = 'https://www.origin.com/en-gb/store/free-games/on-the-house'
def getFreeGames():
try:
response = requests.get(root_url)
soup = bs4.BeautifulSoup(response.text)
return [a.attrs.get('data-title') for a in soup.select('div.packart')]
except requests.exceptions.ConnectionError:
print colored('No internet connection available', 'red')
return ""
def main():
print('Currently free games on Origin: ')
gamesFree = getFreeGames()
for game in gamesFree:
print colored(game.title(), 'green')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment