Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: HOWTO: MLB Baseball scores from the command line!

  1. #1
    Join Date
    Apr 2007
    Location
    Toronto
    Beans
    104
    Distro
    Ubuntu 13.04 Raring Ringtail

    Question HOWTO: MLB Baseball scores from 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 very simple command line to fetch and parse the ESPN MLB scoreboard page.

    Here's some sample output

    Code:
    AMERICAN LEAGUE - GAME 1
       Top 5th
       Toronto (10-12, 5-5 away)
       Tampa Bay (10-11, 6-7 home)
       1 2 3 4 5 6 7 8 9
       0 0 2 0 0
       0 0 1 1
       R H E
       2 5 0
       2 3 0
       GameCast | Box Score | RealTime [in.gif] | Watch
       Balls: Strikes: Outs:
       Pitching: Sonnanstine (TAM) 4.1 IP, 2 ER, 3 K
       Batting: Inglett (TOR) 0-0
       Pitch 4: ball 3
    Here's the command line

    Note you will need Lynx (a non graphical browser)
    Code:
    sudo apt-get install lynx


    Code:
    lynx -nonumbers -dump http://scores.espn.go.com/mlb/scoreboard | egrep -i -A12 -B2 Toronto
    Replace Toronto with your city.


  2. #2
    Join Date
    Jan 2007
    Beans
    152
    Distro
    Ubuntu 11.04 Natty Narwhal

    Thumbs down Re: HOWTO: MLB Baseball scores from the command line!

    that's amazing nice work!

  3. #3
    Join Date
    Aug 2007
    Beans
    2,132

    Re: HOWTO: MLB Baseball scores from the command line!

    Thanks for this - I just had to put quotes around "St. Louis"

  4. #4
    Join Date
    Apr 2008
    Location
    /na/usa/ca
    Beans
    153

    Re: HOWTO: MLB Baseball scores from the command line!

    That is awesome. I need to add that to Conky. Thanks, man!

    EDIT: Hmm... how to auto-update it every few minutes... hmm...
    Last edited by elmer_42; April 25th, 2008 at 02:26 AM.
    archlinux \\ amd+ati \\ subtle \\ website

  5. #5
    Join Date
    Apr 2008
    Beans
    Hidden!

    Re: HOWTO: MLB Baseball scores from the command line!

    can you do one for the nhl? :/

  6. #6
    Join Date
    Apr 2007
    Location
    Toronto
    Beans
    104
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: HOWTO: MLB Baseball scores from the command line!

    Quote Originally Posted by SuperSon!c View Post
    can you do one for the nhl? :/
    Replace "MLB" with "NHL". You'll have to do a little playing around to get the output you like in the egrep parameter.

    Code:
    lynx -nonumbers -dump http://scores.espn.go.com/nhl/scoreboard | egrep -i -A12 -B2 Colorado
    You'll have to fix the output, but it should be easy,

  7. #7
    Join Date
    Apr 2008
    Beans
    Hidden!

    Re: HOWTO: MLB Baseball scores from the command line!

    you my friend, rock! thanks! atm i'm having problems getting anything from the repos, but will continue trying.

  8. #8
    Join Date
    Apr 2007
    Location
    Toronto
    Beans
    104
    Distro
    Ubuntu 13.04 Raring Ringtail

    Talking Re: HOWTO: MLB Baseball scores from the command line!

    Glad it worked out for ya

  9. #9
    Join Date
    Apr 2008
    Location
    /na/usa/ca
    Beans
    153

    Re: HOWTO: MLB Baseball scores from the command line!

    Hello everybody! A very helpful guy in this thread helped me. The code I use for my MLB section is this (from .conkyrc):
    Code:
    ${color 457ccc}MLB ${hr 2}$color
    ${color 457ccc}Boston Red Sox $color
    ${texeci 7200 lynx -nonumbers -dump http://scores.espn.go.com/mlb/scoreboard | egrep -i -A12 -B2 Boston}
    ${color 457ccc}Florida Marlins $color
    ${texeci 7200 lynx -nonumbers -dump http://scores.espn.go.com/mlb/scoreboard | egrep -i -A12 -B2 Florida}
    and here is what it looks like:
    archlinux \\ amd+ati \\ subtle \\ website

  10. #10
    Join Date
    Dec 2007
    Location
    NYC
    Beans
    484

    Re: HOWTO: MLB Baseball scores from the command line!

    Great program! Works like a charm, except I cannot get it to work for the Yankees. I think the two word city is throwing it off. If anyone can help it would be much appreciated.

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •