Created
October 31, 2020 16:41
-
-
Save 0xKD/16cbaba7c879d05c7bab52cd353d2d11 to your computer and use it in GitHub Desktop.
Path of Exile - Download Personal Stash
This file contains 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
""" | |
Usage: | |
python3 poe_stash_download.py $accountname $POESESSID > tabs.json | |
$POESESSID is value of cookie variable (with same name) | |
after you login to the Path of exile website | |
""" | |
import argparse | |
import requests | |
import json | |
def nop(x, *args, **kwargs): | |
return x | |
try: | |
from tqdm import tqdm | |
except ImportError: | |
tqdm = nop | |
BASE_URL = "https://www.pathofexile.com/character-window/get-stash-items" | |
REALM = "pc" | |
LEAGUE = "Heist" | |
def get_stash_tab(account_name, session_id, tab_id=0): | |
params = {"accountName": account_name, "realm": REALM, "league": LEAGUE, "tabs": 0, "tabIndex": tab_id} | |
cookies = {"POESESSID": session_id} | |
resp = requests.get(BASE_URL, params=params, cookies=cookies) | |
return resp.json() | |
def main(account_name, session_id): | |
tabs = [] | |
tabs.append(get_stash_tab(account_name, session_id)) | |
num_tabs = tabs[0].get("numTabs", 0) | |
for tab_id in tqdm(range(1, num_tabs), total=num_tabs-1): | |
tabs.append(get_stash_tab(account_name, session_id, tab_id=tab_id)) | |
print(json.dumps({"tabs": tabs})) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("account_name", type=str) | |
parser.add_argument("session_id", type=str) | |
args = parser.parse_args() | |
main(args.account_name, args.session_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment