0

get player id from name

Hello,

I'm wanting to retrieve a player id, so I can get stats from the player, by inputting the player's name. Does anyone know of a way to do this? When I try using the YQL console, it always says the player key is a required part of the query..but I don't know how to get the player key of the player that I want.

by
6 Replies
  • QUOTE (Tim P @ Mar 4 2011, 06:36 AM) <{POST_SNAPBACK}>
    Hello,

    I'm wanting to retrieve a player id, so I can get stats from the player, by inputting the player's name. Does anyone know of a way to do this? When I try using the YQL console, it always says the player key is a required part of the query..but I don't know how to get the player key of the player that I want.


    You can find the player key by browsing sports.yahoo.com. Find the specific player you are looking for and look at their profile. The key will appear in the address bar. Example:

    Teemu Selanne:
    http://sports.yahoo.com/nhl/players/500

    His key is 500. If you browse through all the leagues and players you can find any key you need.

    Obviously if you are creating a search function you won't want to manually search every player out on your own. I would look into using a Players Collection.

    Hope that pushes you in the right direction.
    0
  • QUOTE (LexFunk @ Mar 5 2011, 02:33 PM) <{POST_SNAPBACK}>
    You can find the player key by browsing sports.yahoo.com. Find the specific player you are looking for and look at their profile. The key will appear in the address bar. Example:

    Teemu Selanne:
    http://sports.yahoo.com/nhl/players/500

    His key is 500. If you browse through all the leagues and players you can find any key you need.

    Obviously if you are creating a search function you won't want to manually search every player out on your own. I would look into using a Players Collection.

    Hope that pushes you in the right direction.

    I totally agree with everything that LexFunk said. :DIt has to be within a league context, because...well, okay, no especially great reason, that's just how we coded it.
    0
  • QUOTE (Sean Montgomery @ Mar 8 2011, 08:14 PM) <{POST_SNAPBACK}>
    It has to be within a league context, because...well, okay, no especially great reason, that's just how we coded it.


    I was confused by this at first as well, but there is actually a good reason. One of the things you can get from the player stats is player_points, which is their total fantasy points for the season and that will vary based on your league's scoring rules.
    0
  • QUOTE (marcus4309 @ Mar 18 2011, 06:31 AM) <{POST_SNAPBACK}>
    I was confused by this at first as well, but there is actually a good reason. One of the things you can get from the player stats is player_points, which is their total fantasy points for the season and that will vary based on your league's scoring rules.

    Ha, right, agreed with that given that we're including that information in that context, but we do allow you to access players directly (by player key) outside of a league context, as we just remove the player_points element. So we really should still be allowing you to search outside of the league context, too.
    0
  • Because the league is created by users themselves, but in my app, I just wanna fetch players info based on real seasons, not the fantasy sports.
    So how can we do that? Simply saying, any easy way to get player_id without league context? Thanx guys! 

    QUOTE(Mark @ 18 Mar 2011 7:31 AM)
    QUOTE (Sean Montgomery @ Mar 8 2011, 08:14 PM) <{POST_SNAPBACK}>
    It has to be within a league context, because...well, okay, no especially great reason, that's just how we coded it.


    I was confused by this at first as well, but there is actually a good reason. One of the things you can get from the player stats is player_points, which is their total fantasy points for the season and that will vary based on your league's scoring rules.
    0
  • That's not what the APIs are intended for.
    0

Recent Posts

in Fantasy Sports API