Quick and Dirty Football Scores Userbar

Today, like most Fall Sunday’s, is a great day to watch Football…

Today, like most Fall Sunday’s, is a great day to watch Football. It was fun watching San Fransisco play, but I often hack around on the computer during games. Fortunately there is plenty of time between commercials and time-outs to work on code. I wondered how hard it would be to pull football scores into a dynamic usebar. Surprisingly, it wasn’t as hard as I thought it would be.

First off, I had to find an API. I ran across this Accidental APIs: NFL edition article that linked to some open JSON API. I decided which API would fit the bill and started to program. Since I use Perl, I updated my CPAN library with the latest version of JSON routines and parsed out the games, progress, and scores. After figuring out some image libraries to pull from, it was only a matter of updating my scripts to display the information as a animated GIF. I did have to tweak my libraries a bit to display two images. I think the end results came out better than expected.

Put in image or BBCODE tag: https://www.reids4fun.com/ub/football.gif

I do need to put some effort into a better background image. I did accomplished my goal of displaying the scores. That is all that matters, for now.

Updated 9/9/2018:
Although the API I used still responds, it doesn’t update for 2018. Doing a little digging, I found the latest scores are now in a new JSON feed. As such, I’ve substituted and updated my football signature. The cool thing is the new API has more details, so I’ve tweaked the text to leverage some of the newer features.

First off, the teams display their nicknames instead of abbreviations. To make it more obvious, I star the winning team’s score. Also, I now display the time left during a quarter. I needed to do some parsing to get the correct day to display. But otherwise, the user bar looks as before.

Updated 1/28/2023:
Okay, the NFL API was broke as they locked down access. I was able to find another API and things appear to be working again. I also tweaked the display a bit based on the details provided. I might improve the bar as I continue testing.

You can check out my other signature bars here.

2 Comments on this article:

Great idea.

Written on Jun 06, 2024 by Anon

You're a legend for keeping this updated for over a decade. I kneel.

re: Great idea.

Written on Jun 12, 2024 by Steven

Ha, thanks! I really should do something more interesting with the API.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive