File size: 457 Bytes
2980fd0
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import json
from core.adapters.stock_footballia import resolve_player
import requests

player_id, _ = resolve_player("Cristiano Ronaldo")
all_goals = []
for page in range(8):
    resp = requests.get(f"https://footballia.eu/goals?player_id={player_id}&page={page}", headers={"User-Agent": "Mozilla/5.0"}, timeout=30)
    data = resp.json()
    all_goals.extend(data.get("goals", []))

with open("goals.json", "w") as f:
    json.dump(all_goals, f, indent=2)