0.3.1 • Published 3 years ago

sportstg-api v0.3.1

Weekly downloads
6
License
ISC
Repository
github
Last release
3 years ago

SportsTG API Build Status

A node.js library to scrape sports information from SportsTG based sites.

Installation

npm install sportstg-api

Usage

const sportstg = require('sportstg-api')

// The compId is the 'c' query param that identifies a SportsTG competition
// It will look something like this: "0-3-0-508661-0"
// http://websites.sportstg.com/comp_info.cgi?c=0-3-0-508661-0" 
const compId = "0-3-0-508661-0"

// Parses the ladder table into an array of objects
// Second parameter is an optional round number
sportstg.getLadder(compId, 2)
    .then((ladder) => {
        // Each object key is a table heading. 
        // Example:
        // [{b: 0, d: 0, ff: 0, fg: 0, gd: 31, l: 0, p: 1, pos: 1, pts: 3, team: "Cool Team", w: 1},...]
    })
    .catch((error) => {
        console.error(error)
    })
    

// Parses a specific round's fixtures into an array of objects
// Second parameter is a non-optional round number
// Third parameter is an optional pool number. Typically 1 = regular season, 1001 = finals.
sportstg.getRoundFixtures(compId, 2, 1)
    .then((fixtures) => {
        // Example:
        // [{homeTeam: 'Team 1', homeScore: 8, awayTeam: 'Team 2', awayScore: 3},...]
    })
    .catch((error) => {
        console.error(error)
    })
0.3.0

3 years ago

0.2.0

3 years ago

0.3.1

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

5 years ago