kevinskyba / kickbase-api-python

MIT License
24 stars 8 forks source link

Get all players #4

Open nicolaischneider opened 3 years ago

nicolaischneider commented 3 years ago

Hi, is there an endpoint to get a list of ALL existing players ? Meaning, all Bundesliga players and not only from transfermarket or your own team. I checked out your page [https://kevinskyba.github.io/kickbase-api-doc/index.html] to find an endpoint but unfortunatelly it wasn't part of the list. I even tried looking for https://api.kickbase.com/players/ or similar endpoints hoping that it would return all players but still no luck.

Thanks for your amazing api, very helpful and well coded!

simonleyh commented 3 years ago

Hi Nicolai, you can get all players through theteam_players(team_id) endpoint. Simply iterate over all teams and append every player to a list. The team_id is a random integer. I just figured them out, here's the list of team_ids:

team_ids = [2,3,4,5,7,9,11,13,14,15,18,19,20,22,24,28,40,43]
playerlist = []

for x in team_ids:
    for player in kickbase.team_players(x):
        playerlist.append(player)
gickowtf commented 3 months ago

24/25 [2, 3, 4, 5, 7, 9, 10, 11, 13, 14, 15, 18, 24, 39, 40, 43, 50, 51]