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.

32 Responses to “From Yahoo to FanGraphs at the Touch of a Button”

You can follow any responses to this entry through the RSS 2.0 feed.
Click here to view comments in a non-threaded output.
  1. BrianA says:

    Immensely cool.

    Vote -1 Vote +1

  2. Andy says:

    So much win here.

    Vote -1 Vote +1

  3. CJett says:

    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.

    Vote -1 Vote +1

  4. Drew says:

    Wither Chrome?

    Vote -1 Vote +1

  5. longbeachyo says:

    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!

    Vote -1 Vote +1

  6. Rick says:

    That is beautiful. Using it in Chrome.

    Vote -1 Vote +1

  7. BosoxBob says:

    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.

    Vote -1 Vote +1

  8. tourinct says:

    Way cool!!!!

    Vote -1 Vote +1

  9. Bob says:

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

    Got morals?Guess not.

    -8 Vote -1 Vote +1

    • I’m sorry I offended you. In my defense, I did write in the second line of the post that I didn’t write the script, and mentioned the author’s name in an earlier comment.

      Vote -1 Vote +1

      • Bob says:

        It’s great that you mentioned the author before.However,when you use someone else’s work you give them credit.Every time.

        Vote -1 Vote +1

  10. 3rd Period Points says:

    I needed this.

    Vote -1 Vote +1

  11. teejay1324 says:

    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.

    Vote -1 Vote +1

  12. Kyle says:

    This is awesome whoever made this rocks!!

    Vote -1 Vote +1

  13. Matt says:

    Die. No. Might.

    Vote -1 Vote +1

  14. jake says:

    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.

    Vote -1 Vote +1

  15. Part-Time Pariah says:

    LOLOLOL, welcome to 2003!!!!

    Vote -1 Vote +1

  16. Astromets says:

    thing is, i would never be on yahoo! sports

    Vote -1 Vote +1

  17. steve mc says:

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

    Vote -1 Vote +1

  18. Chris says:

    I just peed my pants.

    Vote -1 Vote +1

  19. dexterfowlerfan666 says:

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

    Vote -1 Vote +1

  20. Preet says:

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

    Vote -1 Vote +1

  21. Kyle says:

    OH MY GOD THIS IS AWESOME

    /caps lock

    Vote -1 Vote +1

  22. Jimmy Choo says:

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

    Vote -1 Vote +1

  23. tony says:

    I just peed my pants.

    Vote -1 Vote +1

  24. Bridge says:

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

    Vote -1 Vote +1

  25. TD says:

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

    Vote -1 Vote +1

    • Justin says:

      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.

      Vote -1 Vote +1

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*