Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Steam exclusive finder
import requests
import os.path
from tqdm import tqdm
import requests_cache
itad_key = "its where the key goes"
batch_size = 100
requests_cache.install_cache()
def is_eligible(game_data):
if game_data["is_dlc"]:
return False
if game_data["is_package"]:
return False
elif not game_data["reviews"]:
return False
elif game_data["reviews"]["steam"]["total"] < 100:
return False
else:
return True
def is_steam_exclusive(price_data):
if len(price_data["list"]) == 0:
return False
for price in price_data["list"]:
if price["shop"]["id"] != "steam":
return False
return True
all_games_response = requests.get("https://api.isthereanydeal.com/v01/game/plain/list/?key=" + itad_key + "&shops=steam")
all_games_obj = all_games_response.json()["data"]["steam"]
plain_list = [game for key, game in all_games_obj.items()];
plain_list = list(set(plain_list));
plain_list.sort();
with open("output.md", "w+") as output_file:
for i in tqdm(range(0, len(plain_list), batch_size)):
sublist = plain_list[i:i+batch_size]
plains_query = ','.join(sublist)
game_info_response = requests.get("https://api.isthereanydeal.com/v01/game/info/?key=" + itad_key +
"&plains=" + plains_query)
price_response = requests.get("https://api.isthereanydeal.com/v01/game/prices/?key=" + itad_key +
"&plains=" + plains_query)
game_info = game_info_response.json()["data"]
price_info = price_response.json()["data"]
for plain in sublist:
if is_eligible(game_info[plain]):
if is_steam_exclusive(price_info[plain]):
output_file.write("* [" + game_info[plain]["title"] + "](" + game_info[plain]["urls"]["game"] + ")\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.