node package manager

mlb-scores

mlb-scores

Download MLB Scores easily

Usage

var mlb = require('mlb-scores');
 
mlb.getGameUrl('giants', new Date(2015,6, 11), function(err, url){
  if (!err){
    mlb.getGameInfo(url, function(err, data){
      console.log(JSON.stringify(data, null, 4));
    });
  }
})

Installation

  npm intall mlb-scores

Example Output

{
    "home_team_runs": "5",
    "game_type": "R",
    "double_header_sw": "N",
    "location": "Philadelphia, PA",
    "home_recap_link": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=recap&c_id=mlb",
    "away_time": "12:05",
    "away_preview_link": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=preview&c_id=mlb",
    "time": "3:05",
    "top_inning": "N",
    "home_time": "3:05",
    "home_team_name": "Phillies",
    "ind": "F",
    "original_date": "2015/06/06",
    "home_team_city": "Philadelphia",
    "venue_id": "2681",
    "gameday_sw": "P",
    "away_win": "32",
    "home_games_back_wildcard": "18.0",
    "save_pitcher": {
        "last": "Casilla",
        "name_display_roster": "Casilla",
        "era": "2.59",
        "id": "433586",
        "first_name": "Santiago",
        "s_losses": "",
        "s_era": "",
        "saves": "17",
        "last_name": "Casilla",
        "losses": "1",
        "first": "Santiago",
        "s_wins": "",
        "wins": "4"
    },
    "away_team_id": "137",
    "tz_hm_lg_gen": "ET",
    "status": "Final",
    "home_loss": "36",
    "home_games_back": "19.0",
    "home_code": "phi",
    "away_sport_code": "mlb",
    "home_win": "21",
    "time_hm_lg": "3:05",
    "away_name_abbrev": "SF",
    "league": "NN",
    "time_zone_aw_lg": "-4",
    "away_games_back": "5.0",
    "home_file_code": "phi",
    "game_data_directory": "/components/game/mlb/year_2015/month_06/day_06/gid_2015_06_06_sfnmlb_phimlb_1",
    "time_zone": "ET",
    "away_league_id": "104",
    "preview": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=preview&c_id=mlb",
    "away_recap_link": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=recap&c_id=mlb",
    "home_team_id": "143",
    "time_aw_lg": "3:05",
    "away_team_city": "San Francisco",
    "day": "SAT",
    "tbd_flag": "N",
    "tz_aw_lg_gen": "ET",
    "away_code": "sfn",
    "winning_pitcher": {
        "id": "518516",
        "s_losses": "",
        "first_name": "Madison",
        "s_era": "",
        "last": "Bumgarner",
        "last_name": "Bumgarner",
        "losses": "2",
        "era": "3.38",
        "name_display_roster": "Bumgarner",
        "first": "Madison",
        "s_wins": "",
        "wins": "7"
    },
    "game_media": {
        "media": {
            "free": "NO",
            "title": "SF @ PHI",
            "thumbnail": "http://mediadownloads.mlb.com/mlbam/preview/sfnphi_414487_th_7_preview.jpg",
            "media_state": "media_archive",
            "start": "2015-06-06T15:05:00-0400",
            "has_mlbtv": "true",
            "calendar_event_id": "14-414487-2015-06-06",
            "type": "game"
        }
    },
    "game_nbr": "1",
    "time_date_aw_lg": "2015/06/06 3:05",
    "away_games_back_wildcard": "3.5",
    "scheduled_innings": "9",
    "linescore": [
        {
            "away_inning_runs": "2",
            "inning": "1",
            "home_inning_runs": "0"
        },
        {
            "away_inning_runs": "0",
            "inning": "2",
            "home_inning_runs": "0"
        },
        {
            "away_inning_runs": "4",
            "inning": "3",
            "home_inning_runs": "0"
        },
        {
            "away_inning_runs": "0",
            "inning": "4",
            "home_inning_runs": "4"
        },
        {
            "away_inning_runs": "0",
            "inning": "5",
            "home_inning_runs": "0"
        },
        {
            "away_inning_runs": "0",
            "inning": "6",
            "home_inning_runs": "0"
        },
        {
            "away_inning_runs": "1",
            "inning": "7",
            "home_inning_runs": "0"
        },
        {
            "away_inning_runs": "0",
            "inning": "8",
            "home_inning_runs": "1"
        },
        {
            "away_inning_runs": "0",
            "inning": "9",
            "home_inning_runs": "0"
        }
    ],
    "venue_w_chan_loc": "USPA1276",
    "first_pitch_et": "",
    "away_team_name": "Giants",
    "gameday_link": "2015_06_06_sfnmlb_phimlb_1",
    "outs": "3",
    "time_date_hm_lg": "2015/06/06 3:05",
    "id": "2015/06/06/sfnmlb-phimlb-1",
    "home_name_abbrev": "PHI",
    "wrapup_link": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=wrap&c_id=mlb",
    "tiebreaker_sw": "N",
    "balls": "0",
    "ampm": "PM",
    "home_division": "E",
    "home_time_zone": "ET",
    "tv_station": "CSN",
    "away_team_errors": "0",
    "away_team_runs": "7",
    "note": "",
    "away_time_zone": "PT",
    "hm_lg_ampm": "PM",
    "home_sport_code": "mlb",
    "time_date": "2015/06/06 3:05",
    "inning": "9",
    "home_team_hits": "6",
    "inning_state": "",
    "home_ampm": "PM",
    "game_pk": "414487",
    "photos_link": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=photos",
    "venue": "Citizens Bank Park",
    "home_league_id": "104",
    "away_team_hits": "12",
    "away_loss": "25",
    "home_team_errors": "1",
    "away_file_code": "sf",
    "losing_pitcher": {
        "id": "605894",
        "s_losses": "",
        "first_name": "Severino",
        "s_era": "",
        "last": "Gonzalez",
        "last_name": "Gonzalez",
        "losses": "2",
        "era": "8.69",
        "name_display_roster": "Gonzalez, S",
        "first": "Severino",
        "s_wins": "",
        "wins": "2"
    },
    "strikes": "0",
    "aw_lg_ampm": "PM",
    "home_preview_link": "/mlb/gameday/index.jsp?gid=2015_06_06_sfnmlb_phimlb_1&mode=preview&c_id=mlb",
    "time_zone_hm_lg": "-4",
    "away_ampm": "PM",
    "away_division": "W"
}