Yahoo Fantasy Basketball

By Dave 3 Last update Oct 21, 2009 — Installed 15,487 times. Daily Installs: 0, 0, 1, 0, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0

Archived Comments (locked)

Subscribe to Archived Comments 32 posts, 15 voices

</thead>' +

</thead>' +
to
'<thead>
</thead>' +

That should work until Dave has a change to update the script himself.

Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
dayeemasta User

Dave 3,

Awesome work...thanks!

I know this seems greedy, but is there any way you can get your script to work on the "My Watch List" page as well?

-Greg

 
Dave 3 Script's Author

thanks kccputech - you'll have to open a new window or tab and navigate to your opponent's page to see his/her scores

 
kccputech User

Awesome job, well done. No big deal, but is there a way to see your opponents scores for the night? Either I'm a dunce or it's not available. Thanks!

 
aaron1325714 User

hey glenn i know my question has nothing to do with this script but i couldnt find your email anywhere

so i was wondering if you could create this script except for baseball it is a bench all players without a game script

http://userscripts.org/scripts/show/6716

that is the script link

and here is the actual script

// ==UserScript==
// @name Yahoo Fantasy NBA Bench All
// @namespace http://mattandchristy.net/benchall
// @description Provides a button to bench all players without a game
// @include http://basketball.fantasysports.yahoo.com/nba/*...=*
// @include http://basketball.fantasysports.yahoo.com/nba/*...
// ==/UserScript==
//
// Change log:
// 2006-12-10 Initial version of script; used Yahoo Fantasy NBA Game Log Link
// as a base to start developing

var doBench = function(event) {

var allElements;
var thisElement;
var playerLink = "http://sports.yahoo.com/nba/players/"
var gameLogLink;


allElements = document.evaluate(
"//*[contains(@class, 'player')]/..",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);

// burn the first two rows; they are headers, not players
for (var i = 2; i < allElements.snapshotLength; i++) {

thisElement = allElements.snapshotItem(i);

tds = thisElement.getElementsByTagName('td');
nameNode = tds[1];
if(nameNode) {
// td div a textnode value
name = nameNode.firstChild.firstChild.firstChild.nodeValue;

// get the opponent TD's innerHTML; text node won't work because
// the ? for 'no opponent' gets translated to a character =/
opp = tds[3].innerHTML;

if(opp == '?') {

newPosSelectNode = tds[2].firstChild;
// select the 'BN' node for these guys (last option)
newPosSelectNode.selectedIndex = newPosSelectNode.length-1;

GM_log("Benching " + name);
}
}
}

// stop event propagation, if this was a click
if(event) {
event.stopPropagation();
event.preventDefault();
}
}

/* gameLogLink = document.createElement('a'); */
/* gameLogLink.setAttribute("href",thisElement.href + "/gamelog") */
/* //gameLogLink.setAttribute("class","cellindent") */
/* gameLogLink.setAttribute("target","_blank") */
/* gameLogLink.setAttribute("title","game log link") */
/* gameLogLink.innerHTML = "" */
/* thisElement.parentNode.insertBefore(gameLogLink, thisElement.nextSibling.nextSibling); */

var BENCHBUTTON_ID = "bencherButton";
var BENCHBUTTON_TEXT = "[Bench players with no game]";

// create the bench button
var bencher = document.createElement("A");
bencher.addEventListener("click", doBench, true);
bencher.href = "#";
bencher.innerHTML = BENCHBUTTON_TEXT;
bencher.className = 'button';
/* bencher.style.backgroundColor = "#D8D9D5"; */
/* bencher.style.borderTopColor = "#A8A8A8"; */
/* bencher.style.borderBottomColor = "#A8A8A8"; */
/* bencher.style.borderLeftColor = "#A8A8A8"; */
/* bencher.style.borderRightColor = "#A8A8A8"; */
/* bencher.style.borderTopStyle = "outset"; */
/* bencher.style.borderBottomStyle = "outset"; */
/* bencher.style.borderLeftStyle = "outset"; */
/* bencher.style.borderRightStyle = "outset"; */
/* bencher.style.borderTopWidth = "1px"; */
/* bencher.style.borderBottomWidth = "1px"; */
/* bencher.style.borderLeftWidth = "1px"; */
/* bencher.style.borderRightWidth = "1px"; */
bencher.style.paddingTop = "2px";
bencher.style.paddingBottom = "5px";
bencher.style.paddingLeft = "5px";
bencher.style.paddingRight = "5px";
bencher.style.color = "#FFFFFF";
bencher.id = BENCHBUTTON_ID;

// attach the bench button right before the "submit changes" button
// at the bottom of the screen
var buttonBar = document.getElementById('buttonbar');
var inputs = buttonBar.getElementsByTagName('input');
var submitButton = inputs[inputs.length-1]
buttonBar.insertBefore(bencher, submitButton);

i tried to mess around with it a little bit but got no luck

please respond soon

i will post this on a couple other pages to ensure that you get the message

Aaron S

 
Dave 3 Script's Author

suoirafen - the player fix is in. and yes...my saturday night is this boring.

 
suoirafen User

the new update works fine from what i've seen. but i was wondering if it was possible to make it so the links to the player pages could be fixed.

the current links go to basketball.fantasysports.yahoo.com, while they should go to sports.yahoo.com

 
Dave 3 Script's Author

in progress players should be processed correctly now. I didn't have a chance to fully test it since most games have ended but I pushed the change anyway. please let me know if you run into issues.

 
Dave 3 Script's Author

yahoo tweaked their boxscores so I plan to update this script in the next day or two so that in progress games are processed correctly. stay tuned

 
Dave 3 Script's Author

B2608, the script only works when your players are in active/completed games. so if there is no boxscore link on the page, you won't see anything.

 
B2608 User

The "Show freebie stats" shows but nothing happens after I clicked on it. Have tried it on 3 different PCs and even on 1 with firefox and greasemonkey freshly installed. Wondering if anyone else has this issue

 
Dave 3 Script's Author

thanks for the bug report king leo, I fixed the problem.

 
King Leonidus User

I think this may be a one-time fluke, but I was trying to use the script to get the day's totals of my opponent (head-to-head), and he has Shaq on his team. Where the data for Shaq should be, it was Anderson Varejao's name and totals. I say fluke because I'm guessing this will only happen if Shaq & Varejao are in the same box score. My guess is something is going wrong handling the player ID's (Shaq=847; Varejao=3847). This isn't a big deal since they will only meet what two more times this season, but I thought it was worth noting.

 
Chip Whitley User

Thanks for the update Dave, it works great.

 
bawilson Scriptwright

Sorry I messed up on the copy there guys. Dave I saw that your update doesn't include what I called the "started" column. Yahoo also added a column showing if the player started and at what position. Here's what I did to fix it.

'<thead>
Pos NameStartedMinFG3PtFT+/-OffRebAstTOStlBlkBAPFPts 
 
Dave 3 Script's Author

hey guys, thanks for the heads up about the boxscore changes. I just updated the script to handle the new stats.

King Leo, I never anticipated that people would update their weekly stats this way. I wanted this script to be more lightweight than the baseball one so I didn't create the arrays. maybe I'll do that next season or if yahoo makes drastic changes to the boxscore.

 
devohoang User

bawilson I tried the change and couldn't get it to work either. Could you double check the line of code you posted? I just posted the two lines (original and modified) directly next to one another to compare and at a glance they look identical. Thanks

 
bawilson Scriptwright

Chip - I found that if you just modified the script and then reloaded the page that greasemonkey wouldn't pick up that the script had changed. I had to either navigate away from the page and navigate back to it or just remove the "#" symbol from the web address. Let me know if that works for you. Here's a link to a screen shot of it working.

http://www.christinasportraits.com/basketball/S...

 
Chip Whitley User

bawilson, I tried to replace the line that you said and it doesn't fix it. I tried to fix it but I have no idea what i'm doing. Could you help me out?

 
bawilson Scriptwright

Yahoo changed the way their box scores were set up. They´ve added three new columns. The first new column signifies if the player started, second new column is the point differential while the player was on the court, and I´m not sure what the third new column is for with the BA.

I´ve gotten the script to work by changing line 178 in the script from

'<thead>
Pos NameMinFG3PtFTOffRebAstTOStlBlkPFPts 
Pos NameMinFG3PtFTOffRebAstTOStlBlkPFPts 
 
King Leonidus User

hey dave, really fine stuff you've done with both scripts. Just to let you know this script is no longer working as intended because Yahoo added new columns to the box score. I don't know anything about javascript, but I played around with your baseball script because it could do the entire league (as pulled from the standings). I managed to get it working with fantasy basketball to pull stats and even customize the order (using the Array). Although I couldn't figure out how to make it deal with the shooting numbers as you have in the basketball.

If this script will now require a system like the baseball one, where

's are set to be a certain stat, would it be possible to have seperate columns for makes & attempts, and then pct's on another row (or column). This would be a way for the many fans of your script to keep track of their weekly FG%'s on their own.

Thanks for your hard work with this script. I can't wait for the next brilliant update.

 
linkin06 User

yea i was referring to head to head leagues. it is rather easy to just look at the match up stats from yahoo and adding in today's stats. it's just with fg%, it doesn't work out as well. so i suppose it'd be really easy to just keep track of the weekly attempted and made shots at a minimum for a better idea where your fg and ft% stands. thanks for all your work.

 
Joey Boy User

wow...nvm i got it to work

much thanks man!

 
Joey Boy User

IT DOES'NT WORK MAN!!!

I downloaded it...then downloaded the script and went to fantasy basketball on yahoo and none of the stats showed!

 
Dave 3 Script's Author

linkin06 - is this for a h2h league? don't they already have something similar when looking at the matchups? they don't have the current days score but you could always open two windows; one for your team and the other for your opponent. if enough people want this feature I'd definitely consider it.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel