Skip to content

Instantly share code, notes, and snippets.

@mul14
Forked from SliceOLife/origin_monitor.py
Created May 19, 2016 04:51
Show Gist options
  • Save mul14/a7f9efabdc34c2c5eb00f852ba9feee8 to your computer and use it in GitHub Desktop.
Save mul14/a7f9efabdc34c2c5eb00f852ba9feee8 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