Skip to content

Instantly share code, notes, and snippets.

@tcprescott
Created November 29, 2018 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcprescott/42eb94d0172b2bc04a0db25b0a93db59 to your computer and use it in GitHub Desktop.
Save tcprescott/42eb94d0172b2bc04a0db25b0a93db59 to your computer and use it in GitHub Desktop.
GDQ registration scraper
#in the "cookie" variable, replace remember_abc123456 with the name of your remember_* cookie in your browser
#and remembertokenhere with the token for that cookie
#you can find the cookie in chrome by going into the developer tools while on the page (Control-Shift-I in Windows)
#go to Application tab, choose Cookies
#uses python 3.6
#pip3 install requests
#pip3 install BeautifulSoup4
#pip3 install lxml
from bs4 import BeautifulSoup
import requests
page_link = 'https://gamesdonequick.com/profile'
cookie = {
'remember_abc123456': 'remembertokenhere'
}
page_response = requests.get(
page_link,
timeout=5,
cookies=cookie
)
soup = BeautifulSoup(page_response.text, 'lxml')
regcount = soup.find('p', {'class': 'text-center'},text=True).contents[0].contents[0].split(' / ')
if int(regcount[0]) < int(regcount[1]):
print('GDQ Registrations available')
else:
print('GDQ registrations unavailable')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment