From Yahoo to FanGraphs at the Touch of a Button

Another Edit: Some comments, like this one, have asked about the author of the script. The universally positive feedback for this goes to Justin Swift.

Edit: Commenter CJett pointed out that this script can be readily installed on Google’s Chrome browser as well as FireFox. I’ve edited the post slightly to reflect this addition.

Disclaimer 1: This has nothing to do with my previous post on the Yahoo Fantasy Sports API.

Disclaimer 2: You must be using FireFox or Chrome to enjoy the script described in this post.

Disclaimer 3: I didn’t write the script, so I won’t take credit or blame for it (though it deserves the former).

Now that we’ve gotten that out of the way, let’s get on with business.

Greasemonkey is a FireFox browser extension that allows users to manipulate web pages after loading them. Why is that cool? Because it lets you add a link to FanGraph’s beside each player’s name on Yahoo’s Fantasy Baseball page, like this:

Here’s how to give it a try:

0. If you’re on FireFox, proceed to step 1. If you’re using Chrome, skip ahead to step 2.

1. Install the Greasemonkey plug-in into FireFox. If you don’t have FireFox, I recommend checking it out; it’s a free, high-quality browser. Once you have FireFox, installing Greasemonkey is a one click process, but it does require a browser restart.

2. Install the FanGraphs link script. Before doing so, please be sure to read the userscripts.org disclaimer. If you’re cool with the disclaimer and terms of service, head over to the link script’s page. Click the “install” button and you’re all set. If you’re so inclined, you can check out the script’s source code.

3. Head over to Yahoo Fantasy Baseball, and try clicking the small FanGraphs icon that should now appear beside each player’s name. It should open a link to the player’s FanGraphs page in a new browser tab or window.

4. If you ever want to remove this script from your browser, perform the following steps: on your browsers menu bar, choose Tools > Greasemonkey > Manage User Scripts; highlight Yahoo Fantasy – FanGraphs Link in the list of scripts; and click the uninstall button.

Another disclaimer: I tried this script on two computers, one Windows and one Linux, and it seems to work fine and the source code looks safe to me. But as a rule of thumb, be careful with what you install on your browser. If you aren’t sure if something is safe to install or not, my recommendation is not to install it.

How’s it work?

In a nutshell, after you load a web page in your browser, you have a full html document loaded on your computer for the browser to display. Greasemonkey uses this premise to provide a means to customize the html in your browser. The script that we just installed works because of Yahoo’s good html design. Each player’s name is placed in a container called a <div> which is further defined as “name” (<div class=”name”>). So the script looks for the player names identified in the html, grabs the name from inside the <div> container, generates a link to FanGraphs, and appends it to the original <div> container.



Print This Post



Patrick Newman is a veteran enthusiast of Japanese baseball who happens to write about it at npbtracker.com, and on Twitter @npbtracker.


Sort by:   newest | oldest | most voted
BrianA
Member
BrianA
5 years 11 months ago

Immensely cool.

Andy
Guest
Andy
5 years 11 months ago

So much win here.

CJett
Guest
CJett
5 years 11 months ago

It works with Google Chrome too, and you don’t have to install greasemonkey because the scripts are installed like an extension, so just go straight to step 2.

Drew
Guest
5 years 11 months ago

Wither Chrome?

Drew
Guest
5 years 11 months ago

Whoops, I see it now. Also; whither.

longbeachyo
Member
Member
longbeachyo
5 years 11 months ago

FRICKIN’ AWESOME! You guys RULE. I’m still waiting for a head-to-head players comparison page though. Once that happens I will be your man-slave for life!

Rick
Guest
5 years 11 months ago

That is beautiful. Using it in Chrome.

zimm
Member
zimm
5 years 11 months ago

neato!

BosoxBob
Guest
BosoxBob
5 years 11 months ago

Awesome! Often when I’m checking out free agents, I come here to get the real scoop on players, such as whether their recent good play is just luck or a real change in performance. So instead of “Click FanGraphs bookmark… Type in player’s name… Select player from list”, it’s a simple point-and-click.

tourinct
Guest
tourinct
5 years 11 months ago

Way cool!!!!

Bob
Guest
Bob
5 years 11 months ago

Wow- you didn’t even credit the author of the script.

Got morals?Guess not.

3rd Period Points
Guest
3rd Period Points
5 years 11 months ago

I needed this.

Tom Pinzone
Member
5 years 11 months ago

The fact that I saw this post because I was coming to the site to check out a player’s stats for a possible trade on yahoo makes it even more awesome.

This is fantastic.

Kyle H
Member
Kyle H
5 years 11 months ago

This is awesome whoever made this rocks!!

Matt
Guest
Matt
5 years 11 months ago

Die. No. Might.

jake
Guest
jake
5 years 11 months ago

any way to get this to work for ESPN fantasy? I don’t like ESPN fantasy one bit, but I can’t really change that now and this would be great.

Part-Time Pariah
Guest
Part-Time Pariah
5 years 11 months ago

LOLOLOL, welcome to 2003!!!!

Astromets
Member
5 years 11 months ago

thing is, i would never be on yahoo! sports

steve mc
Guest
steve mc
5 years 11 months ago

how about for CBS? i actualy think CBS is better for fantasy baseball than yahoo or espn…

Chris
Guest
Chris
5 years 11 months ago

I just peed my pants.

dexterfowlerfan666
Guest
dexterfowlerfan666
5 years 11 months ago

The Yahoo main page articles link me to Scott Pianowski’s player profile, but all I’m getting is errors. Hmmm….

Preet
Member
Preet
5 years 11 months ago

Wow, this is absolutely cool and so darn easy to install. I love it. Thanks to all involved!

Kyle
Guest
5 years 11 months ago

OH MY GOD THIS IS AWESOME

/caps lock

Jimmy Choo
Guest
5 years 3 months ago

Awesome, thats a products themes for mee… every other people internet site because of this themes?

tony
Guest
4 years 11 months ago

I just peed my pants.

Bridge
Guest
4 years 9 months ago

fabuloso a tritro si oguiu iugias con lintos. rariamedo iremos se erparba son lejora mi rarquis compento y empeo cintorces ticos.

TD
Guest
TD
4 years 2 months ago

Can this be updated? doesnt seem to work on my updated firefox browser

Justin
Guest
4 years 2 months ago

It should still work fine the first time you visit your team page. When you click one of the tabs (“Projected Stats”, “Research”) or other filters (“Last 7 Days”), the buttons disappear.

I (or somebody else) could certainly fix that, but it hasn’t really bothered me too much. A refresh of the page will bring the buttons back.

Keith
Guest
Keith
2 years 4 months ago

Doesn’t seem to be working for me this season with the updates to the team page format Yahoo made. I loved this thing in past seasons and would be very sad if it is gone. Any updates coming?

mk
Guest
mk
2 years 3 months ago

Its not working for me anymore in either Chrome or Firefox

Keith
Guest
Keith
2 years 3 months ago

Can someone at fangraphs please update the code?

Bob
Guest
Bob
2 years 2 months ago

I agree with the above 2 posters. I have utilized this heavily in seasons past, and I would appreciate it greatly if someone could update this.

wpDiscuz