Skip to content

Instantly share code, notes, and snippets.

@Ze1598
Last active July 28, 2021 22:41
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 Ze1598/dc94bf74fae999580244dab00ef89b85 to your computer and use it in GitHub Desktop.
Save Ze1598/dc94bf74fae999580244dab00ef89b85 to your computer and use it in GitHub Desktop.
Arknights - scrape operator level up stats
import requests
import pickle
from bs4 import BeautifulSoup
req = requests.get("https://gamepress.gg/arknights/tools/interactive-operator-list")
soup = BeautifulSoup(req.content, "lxml")
# Get all the table cells (<td>) with information about the operators
op_list = soup.find_all("td", class_="operator-cell")
op_dict = {}
for op in op_list:
# Get the name and their personal page from these HTML elements
name = op.find("div", class_="operator-title").a.text
page = "https://gamepress.gg" + \
op.find("div", class_="operator-title").a["href"]
# Add the new information to the dictionary
op_dict[name] = page
# Additional manually discovered alternate form operators
op_dict["Amiya (Guard)"] = "https://gamepress.gg/arknights/operator/amiya-guard"
# Write this dictionary to a pickle file
with open("operator_pages.pickle", "wb") as f:
pickle.dump(op_dict, f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment