19 lines
723 B
Python
19 lines
723 B
Python
import json, urllib.request
|
|
|
|
searches = ["Violent", "Scoot", "Ripper", "Inquisitioner", "Sparkles"]
|
|
HEADERS = {"Content-Type": "application/json", "User-Agent": "Mozilla/5.0"}
|
|
|
|
for s in searches:
|
|
b = json.dumps({"search": s}).encode()
|
|
r = urllib.request.Request(
|
|
"https://runeterra.ar/api/cards/get/en_us?game=chrono",
|
|
data=b,
|
|
headers=HEADERS,
|
|
)
|
|
d = json.loads(urllib.request.urlopen(r, timeout=10).read())
|
|
print(f"Search '{s}': {len(d['cards'])} results")
|
|
for c in d["cards"]:
|
|
print(f" {c['name']} - {c['rarity']} - {c['artistName']}")
|
|
for ac in c.get("associatedCards", []):
|
|
print(f" ac: {ac['name']} - {ac['rarity']} - {ac['artistName']}")
|