![]() |
real time MLB baseball scores at the command line
I often want to check the baseball score without opening a browser. (That's right, it's too much work. And sometimes not appropriate at work, considering how much I check it.) So I wrote this script to fetch and parse the ESPN MLB scoreboard page.
Here's some example output: Code:
$ ./mlbscores bostonHere's the code: Code:
#!/usr/bin/env python |
I'm not a sports fan myself, but excellent work here. Very clever, I am sure there are many people who would be interested in such a thing.
I wonder if you couldn't put this up on Sourceforge and maybe start to expand it a bit. Say, have it run in the background checking scores and email the user when such and such team wins; that sort of thing. Everyone loves niche software. |
i wonder if it could be expanded to other sports? Regardless, good program and thanks for sharing with us, there are bound to be a lot of people here who would find it useful. Wonder who will be first to create a GUI for it? :)
|
Very nice! How do I save it in the
form of a file? |
Thanks for the comments. I think I will look into Sourceforge. I've never contributed before.
Quote:
It should work fine if you just copy what's in the text box above and paste it into a text file, say mlbscores. Indentation is important in python, so copy it exactly. As long as you have python you should then be able to run it as Code:
$ python mlbscoresCode:
$ ./mlbscores |
w00000000t!!!!!!
i LOVE this!!!! you are a freaking genius!!!!!!! i bow before you, buddha of the cli.
|
Thanks. I'm glad ESPN didn't change their website--my script still works as is from last year. But I had some bug fixes since I originally posted this, e.g. it wasn't reporting extra innings games correctly. Here's the latest:
Code:
#!/usr/bin/env python |
Hello,
That is really nice. One thing I noticed is that when it encounters a game with extra innings, it doesn't show the earlier innings - they get cut off. There is enough space in the terminal to be able to show all the innings, even extra innings within reason (no 30 inning games :p). But, yes a very nice program. Well done! |
This is very cool. For contrast, here's the lazy version.
Code:
~>which xps(Graphical browsers sux ;) |
Quote:
I still might fix my script's issue with the missing early innings for extra innings games that JMJ_coder mentions, for posterity's sake and in case others find that helpful, but I like this lynx/grep approach MUCH better. Thanks! |
i don't understand.
eveostay,
i've used lynx before but i don't understand how to use your script. and could you explain how it works a little bit? i'm still a noob but i want to learn as much as possible. thanks, rich |
Quote:
Different versions of lynx might have different command line options, so you might need to read that manual too. The "!*" part passes in the argument you supply to egrep. You might have better luck just getting it to work from the command line first (without the alias) try Code:
lynx -nonumbers -dump http://scores.espn.go.com/mlb/scoreboard | egrep -i -A12 -B2 PhilaHTH. Quote:
Steve |
| All times are GMT -5. The time now is 01:22 AM. |