This post is out of date, the program has been updated to work for 2010 see here: http://matburt.net/?p=103
Every year around this time I find myself faced with a problem. I really enjoy football and playing fantasy football but I’m pretty much locked into Yahoo’s terrible web interface.
Each year I tell myself I’m going to throw something together so I can access my Yahoo Fantasy leagues in Python and somehow bypass needing a web browser altogether.
Since I’m managing a team for my employer in a multi-company league I thought it would be nice to be able to generate an RSS feed so that everyone in the company could see how we are doing without needing to access the team or league pages directly.
This small Python utility uses Beautiful Soup, Mechanize and PyRSS2Gen to login to Yahoo and scrape the main league page for the appropriate details.
fantasy-tracker project on git.matburt.net
Wouldn’t it be nice if Yahoo actually provided an API so that we didn’t have to do stupid stuff like this?
It should be easy to take and extend this to do other things and make it more featureful. Like dbus notifications and whatnot.
Hello,
I am trying to do something similar but simplar. I want to access our hockey fantasy site on yahoo and copy the score of everybody each day. I tried using urllib2 but I cannot seem to get access to the wanted page. Is this why you use ‘mechanize’?
Cheers.
I actually chose to use mechanize because it deals with cookies a lot better, which are absolutely required if you are going to log in to Yahoo.
Mat,
This has been working great for me, until today. Yahoo has switched their main league page from the “Standings” tab to the “Playoffs” tab. Have you got any thoughts on the best way to fix the script to handle this?
Hey David, I’ll take a look at this… it should be trivial to make the change.