Created
June 9, 2020 21:42
-
-
Save dinhani/b916c439159b29925157e41552499c53 to your computer and use it in GitHub Desktop.
Claim all games from itch.io Racial Justice to your library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# libraries | |
from selenium import webdriver | |
# information to fill | |
YOUR_USERNAME = "itchio_username" | |
YOUR_PASSWORD = "itchio_password" | |
YOUR_DOWNLOAD_LINK = "https://itch.io/bundle/download/itchio_unique_code" | |
# init browser | |
driver = webdriver.Chrome() | |
# login | |
driver.get("https://itch.io/login") | |
driver.find_element_by_css_selector("[name=username]").send_keys(YOUR_USERNAME) | |
driver.find_element_by_css_selector("[name=password]").send_keys(YOUR_PASSWORD) | |
driver.find_element_by_css_selector(".buttons .button").click() | |
# iterate until get all games | |
page = 1 | |
while True: | |
try: | |
# get download page | |
url = YOUR_DOWNLOAD_LINK + "?page=" + str(page) | |
print(url) | |
driver.get(url) | |
# try to claim game | |
claim_button = driver.find_element_by_class_name("button[value=claim]") | |
claim_button.click() | |
except: | |
# no more games to claim in this page, go to next page | |
page = page + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment