Yahoo - Sort Rosters by Rank browser add-on - Fantasy Basketball Cafe 2014
Fantasy Basketball Cafe


Return to Fantasy Basketball Leftovers

Yahoo - Sort Rosters by Rank browser add-on

Moderator: Basketball Moderators

Yahoo - Sort Rosters by Rank browser add-on

Postby there » Fri Jan 04, 2013 3:52 am

Just finished a browser add-on that will sort by ranking the players in your line-ups. It will process as many leagues as necessary at once, for as many days into the future as is desired. The add-on determines every possible line-up then sorts the line-up by the players' 7-day and 14-day rankings.

Would love to hear feedback!

For Google Chrome: https://chrome.google.com/webstore/deta ... lbpmbadhpb
For Mozilla Firefox: https://addons.mozilla.org/en-US/firefo ... ortplayers
For Mozilla Firefox (Greasemonkey user script): http://userscripts.org/scripts/show/155299
there
Driveway Dunker
Driveway Dunker


Posts: 5
Joined: 16 Oct 2012
Home Cafe: Basketball

Re: Yahoo - Sort Rosters by Rank browser add-on

Postby Fantasy Sports Genie » Thu Jan 10, 2013 8:03 pm

there wrote:Just finished a browser add-on that will sort by ranking the players in your line-ups. It will process as many leagues as necessary at once, for as many days into the future as is desired. The add-on determines every possible line-up then sorts the line-up by the players' 7-day and 14-day rankings.

Would love to hear feedback!

For Google Chrome: https://chrome.google.com/webstore/deta ... lbpmbadhpb
For Mozilla Firefox: https://addons.mozilla.org/en-US/firefo ... ortplayers
For Mozilla Firefox (Greasemonkey user script): http://userscripts.org/scripts/show/155299

I downloaded your Firefox add-on to try to see what you did, but I'm not finding any hint of how to use it or how it works. Can you fill me in?
Fantasy Sports Genie
High School Hoopster
High School Hoopster

User avatar

Posts: 199
(Past Year: 17)
Joined: 1 Feb 2007
Home Cafe: Baseball
Location: Sunnyvale, CA

Re: Yahoo - Sort Rosters by Rank browser add-on

Postby there » Thu Jan 10, 2013 8:24 pm

Hi,

The program is supposed to run on the homepage for Yahoo fantasy NBA, i.e. at any of the following URLs:

http://basketball.fantasysports.yahoo.com
http://basketball.fantasysports.yahoo.com/
http://basketball.fantasysports.yahoo.com/nba
http://basketball.fantasysports.yahoo.com/nba?lid=[any of your league Ids]

These are all end up at the same page of course, the fantasy NBA homepage, which has a list of your leagues. The program only adds a menu item on this page, so you have to click the menu item to start the program. The menu item is "Sort Rosters".

When browsing to one of the above URLs does the "Sort Rosters" link appear?

Here's the image from the Firefox add-on page showing "Sort Rosters": https://addons.cdn.mozilla.net/img/uplo ... 1357108165
there
Driveway Dunker
Driveway Dunker


Posts: 5
Joined: 16 Oct 2012
Home Cafe: Basketball

Re: Yahoo - Sort Rosters by Rank browser add-on

Postby Fantasy Sports Genie » Fri Jan 11, 2013 7:49 pm

I see it now, thanks. I believe everything you need to do what you're doing is available via our public web services. Out of curiosity, why did you choose to write it using screen scraping rather than using the API's?
Fantasy Sports Genie
High School Hoopster
High School Hoopster

User avatar

Posts: 199
(Past Year: 17)
Joined: 1 Feb 2007
Home Cafe: Baseball
Location: Sunnyvale, CA

Re: Yahoo - Sort Rosters by Rank browser add-on

Postby there » Fri Jan 11, 2013 8:12 pm

Wow! Just wow. Yahoo has an API for fantasy.

Well, guess the next stop will be the API docs, and the program will need to be updated. The idea of searching for an API never quite occurred, so a bit of lapsed judgment on my part.

By the way, the program is close to being set up for hockey also, once the season gets underway of course. If you have a hockey league try sorting a roster after about the 15th of Jan. (when games are scheduled rather than "Canceled"). Because the season hasn't started, the program falls back to using O-Rank rather than 7- and 14-day rankings.

The script was updated to include hockey a few days ago. Firefox add-on isn't up right now, so you'll need to get a recent version from userscripts.org or Chrome.

Yeah, very nice - thanks for mentioning this! Will be checking out http://developer.yahoo.com/fantasysports/guide/.
there
Driveway Dunker
Driveway Dunker


Posts: 5
Joined: 16 Oct 2012
Home Cafe: Basketball

Re: Yahoo - Sort Rosters by Rank browser add-on

Postby there » Sat Jan 12, 2013 7:52 am

Well, it doesn't look like much information from the API, if any, is available without using OAuth. OAuth would be great to for stability, and to avoid screen scraping, etc. However, the user is already logged into Yahoo on their side, and so their league & roster information is already available.

For example... User's leagues & teams are available on the page where the program is running, i.e. http://basketball.fantasysports.yahoo.com.

Requests made by the program are below. In order of how they are called in the program:

Get requests:
1) Try starting all active players. This does not start players based on any kind of ranking, so you may end up benching your best player and playing your worst.
Code: Select all
/leagueId/teamId/startactiveplayers?date=xx-xx-xxxx&crumb=xxxxx

2) In the case that there are benched players the program will need to decide which players to use, based on their rankings. This is the URL for rankings.
Code: Select all
/leagueId/teamId?date=xx-xx-xxxx&stat1=K


Post requests (only one):
3) Posts the best line-up.
Code: Select all
/leagueId/teamId/editroster?yspglobalform=&date=xx-xx-xxxx&crumb=xxxxx&jsubmit=Submit%20Changes&ret=dnd[&playerId=playerPosition, ...]
there
Driveway Dunker
Driveway Dunker


Posts: 5
Joined: 16 Oct 2012
Home Cafe: Basketball

Re: Yahoo - Sort Rosters by Rank browser add-on

Postby BaezBlasts » Tue Mar 25, 2014 10:58 pm

Hi there,

Great script. Does this work currently? Any hope for an update?
BaezBlasts
Towel Boy


Posts: 1
(Past Year: 1)
Joined: 25 Mar 2014
Home Cafe: Baseball


Return to Fantasy Basketball Leftovers

Who is online

Users browsing this forum: No registered users and 5 guests

cron
Forums Articles & Tips Sleepers Rankings Leagues




  • Fantasy Basketball
  • Article Submissions
  • Privacy Statement
  • Site Survey 
  • Contact