30 lines
892 B
Python
30 lines
892 B
Python
import subprocess
|
|
import sys
|
|
|
|
API_KEY = "de3b01db-9be3-4c80-bd80-d47e071b320e"
|
|
UA = "BSN-OpenClaw/1.0 (Brettspiel-News.de; kontakt@brettspiel-news.de)"
|
|
|
|
# Top 15 IDs from hotness
|
|
ids = [
|
|
"400366", "472021", "403150", "434172", "425549",
|
|
"415848", "436217", "457008", "357873", "418059",
|
|
"417197", "432456", "454103", "381248", "342942"
|
|
]
|
|
|
|
for gid in ids:
|
|
url = f"https://boardgamegeek.com/xmlapi2/thing?id={gid}&stats=1"
|
|
cmd = [
|
|
"curl", "-s", "--max-time", "20",
|
|
"-H", f"User-Agent: {UA}",
|
|
"-H", f"Authorization: Bearer {API_KEY}",
|
|
url
|
|
]
|
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
outfile = f"/home/hermes/workspace/bgg-scrape/game_{gid}.xml"
|
|
with open(outfile, 'w') as f:
|
|
f.write(result.stdout)
|
|
size = len(result.stdout)
|
|
print(f"Game {gid}: {size} bytes")
|
|
|
|
print("Done fetching details.")
|