dynastyprocess / data

An open-data fantasy football repository, maintained by DynastyProcess.com
https://dynastyprocess.com
GNU General Public License v3.0
73 stars 19 forks source link

Rotoworld uses three types of IDs #6

Closed tomweingarten closed 4 years ago

tomweingarten commented 4 years ago

Thanks for creating this database, it's very helpful. I've only looked into this a little, but it looks like Rotoworld uses different IDs for the player's page URL, the API calls to get news about the player, and the player's profile image. The ID listed in this database appears to be the profile image ID. It would be helpful to have all three, depending on what the user's goal is. If you're going to choose only one, I might recommend the player URL ID, because you can get the other two from there.

For example, for Aaron Rodgers the URL is: https://www.rotoworld.com/football/nfl/player/7815/aaron-rodgers The ID for his profile image (the one used in DynastyProcess) is 3118 The ID used for searching news articles is 39071

tanho63 commented 4 years ago

Hey Tom, thanks for reaching out! I'll have a look - our DB is primarily based as a compilation of other APIs with a dose of name-merging. MFL and Sleeper both seem to have Rodgers listed as 3118 for rotoworld ID, which I agree is a little unhelpful!

I'll see what I can do to find a source/scrape for the right ID - may have to crawl Rotoworld which isn't super ideal.

tomweingarten commented 4 years ago

I may have spoken too soon! It looks like there is a way to use the IDs in your database (like 3118) to retrieve players by using this URL: http://www.rotoworld.com/player/nfl/{PLAYER_ID}

It redirects you to the canonical URL, which has a different ID. From there, you can parse the javascript to get the third ID you need for AJAX calls by looking for the 'currentPath' property in the drupal-settings-json.

Thanks for putting this together!

tanho63 commented 4 years ago

Neat! I'll have to remember/save that in a documentation somewhere :)