Closed Zatfer17 closed 2 years ago
Hey @Zatfer17 since the package is just scraping Understat's website it's not always possible to mimic their functionality. The filtering they do on the website is done on their backend so we can't do the same, but you can you can always filter it manually yourself (probably best) or by using any of the keys as shown in the documentation:
async def main():
async with aiohttp.ClientSession() as session:
understat = Understat(session)
results = await understat.get_team_players(
"Manchester United",
2018,
position="F S"
)
print(json.dumps(results))
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
[
{
"id": "594",
"player_name": "Romelu Lukaku",
"games": "27",
"time": "1768",
"goals": "12",
"xG": "12.054240763187408",
"assists": "0",
"xA": "1.6836179178208113",
"shots": "50",
"key_passes": "17",
"yellow_cards": "4",
"red_cards": "0",
"position": "F S",
"team_title": "Manchester United",
"npg": "12",
"npxG": "12.054240763187408",
"xGChain": "12.832402393221855",
"xGBuildup": "3.366600174456835"
}
]
Hi! Is it possible to filter the get_team_players result by date/game week? On the website I can see you can filter the result by start and end date, but not sure how to do that with the API.
Matteo