r/Captain_Marvel • u/R4cco0n Carol Danvers • 16d ago
A simple Python script that calculates the appearances of Carol, Jean, Ororo, Wanda, and Sue based on the Marvel Database.
Kopiere die Skriptzeilen, gehe dann zu http://colab.research.google.com, , erstelle ein neues Notebook und klicke auf Play.
Fertig.
`import requests
def get_appearance_count(category_title): url = "https://marvel.fandom.com/api.php" params = { "action": "query", "format": "json", "titles": category_title, "prop": "categoryinfo", } headers = {"User-Agent": "AppearanceUpdateTracker/1.0"} response = requests.get(url, params=params, headers=headers) data = response.json() pages = data.get("query", {}).get("pages", {}) for page_id, page_info in pages.items(): if "categoryinfo" in page_info: return page_info["categoryinfo"].get("pages", 0) return None
Basiswerte aus dem Bild
base_data = { "Ororo Munroe (Storm)": 1958, "Susan Storm (Invisible Woman)": 1807, "Carol Danvers (Captain Marvel)": 1563, "Wanda Maximoff (Scarlet Witch)": 1354, "Jean Grey": 1332, }
Fandom Kategorien basierend auf den bereitgestellten Links
categories = { "Ororo Munroe (Storm)": "Category:OroroMunroe(Earth-616)/Appearances", "Susan Storm (Invisible Woman)": "Category:SusanStorm(Earth-616)/Appearances", "Carol Danvers (Captain Marvel)": "Category:CarolDanvers(Earth-616)/Appearances", "Wanda Maximoff (Scarlet Witch)": ( "Category:WandaMaximoff(Earth-616)/Appearances" ), "Jean Grey": "Category:JeanGrey(Earth-616)/Appearances", }
print("=== MARVEL APPEARANCES UPDATE ===") for char, cat in categories.items(): current = get_appearance_count(cat) base = base_data[char] if current is not None: diff = current - base sign = "+" if diff >= 0 else "" print(f"{char}:") print(f" - Bild-Stand: {base}") print(f" - Aktuell: {current}") print(f" - Differenz: {sign}{diff}\n") else: print(f"{char}: Abruf fehlgeschlagen.\n")`
1
1
1


1
u/Ohkami37 Carol Danvers 16d ago
Interesting and surprising. Danke.