Skip to content

andrewrjohn/scoreboard-api

Repository files navigation

Scoreboard API

Express.js API that scrapes ESPN for sports scores and stats, written with TypeScript, updated every 30 seconds ⚡️

Demo

https://scores.weaklytyped.com

Features

Currently these are the supported sports:

  • MLB
  • NBA
  • NFL
  • NCAAM (top 25 men's college basketball)
  • NCAAF (top 25 men's college football)

API Reference

View the endpoint reference here to see all available endpoints

Example

# GET https://scores.weaklytyped.com/api/v1/sports/mlb/events


{
   "date":"2021-08-27T17:51:31.808Z",
   "scores":[
      {
         "startTime":"2021-08-27T23:05Z",
         "shortName":"ARI @ PHI",
         "status":{
            "inning":1,
            "state":"pre",
            "detail":"Fri, August 27th at 7:05 PM EDT",
            "shortDetail":"8/27 - 7:05 PM EDT",
            "completed":false
         },
         "teams":{
            "awayTeam":{
               "shortDisplayName":"Diamondbacks",
               "alternateColor":"000000",
               "color":"a40013",
               "displayName":"Arizona Diamondbacks",
               "name":"Diamondbacks",
               "logo":"https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/ari.png",
               "location":"Arizona",
               "abbreviation":"ARI",
               "isActive":true,
               "score":"0"
            },
            "homeTeam":{
               "shortDisplayName":"Phillies",
               "alternateColor":"284898",
               "color":"be0011",
               "displayName":"Philadelphia Phillies",
               "name":"Phillies",
               "logo":"https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/phi.png",
               "location":"Philadelphia",
               "abbreviation":"PHI",
               "isActive":true,
               "score":"0"
            }
         }
      },
      ...
   ]
}

Run Locally

Clone the project

  # Using HTTPS
  git clone https://github.com/andrewrjohn/scoreboard-api.git

  # Using SSH
  git clone [email protected]:andrewrjohn/scoreboard-api.git

Go to the project directory

  cd scoreboard-api

Install dependencies

  # Using NPM
  npm install

  # Using Yarn
  yarn install

Start the server

  # Using NPM
  npm run start

  # Using Yarn
  yarn start

Client Wrappers

Use the following libraries if you want an easy way to consume this API in your frontend apps:

Feedback

If you have any feedback, please create an issue

Uptime Monitoring

Checkout the Weakly Typed status page for realtime uptime monitoring: https://stats.uptimerobot.com/6xr1KcPrg8

Support this Project

Find yourself using this API, or just think this is cool and want to see continued development of it? Please consider supporting Weakly Typed to help keep this project alive ✊

License

MIT