# pypi:humblebundle has to deal with captchas. I can't be bothered. import requests import json import subprocess keys = [k["gamekey"] for k in json.loads(""" #paste contents of https://www.humblebundle.com/api/v1/user/order here """) # Open your browser's Network console while going to the above url, find the headers, paste them below headers = {"Cookie": "", "User-Agent": ""} # stackoverflow is the best def execute(cmd): popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) for stdout_line in iter(popen.stdout.readline, ""): yield stdout_line popen.stdout.close() return_code = popen.wait() if return_code: raise subprocess.CalledProcessError(return_code, cmd) def get(key): return requests.get("https://www.humblebundle.com/api/v1/order/{}".format(key), headers=headers).json() for k in keys: resp = get(k) if not resp["subproducts"]: continue for sp in resp["subproducts"]: for dl in sp["downloads"]: if dl.get("download_struct", []) and dl["download_struct"][0].get("url", {}).get("bittorrent", ""): try: for line in execute(["mkdir", dl["platform"]]): pass except: pass url = dl["download_struct"][0]["url"]["bittorrent"] for line in execute(["wget", url, "-O", "{}/{}".format(dl["platform"], url.split("/")[-1].split("?")[0])]): print(line, end="")