This module makes grabbing and parsing match data from GosuGamers.net simple. All methods are static, so no need to instantiate.
Install via npm install gosugamers-api
.
Use in your project just by including the module and running the methods.
var Gosu = require('gosugamers-api');
Gosu.fetchMatchUrls('dota2', function(err, urls) {
console.log(urls);
});
Returns a list of URLs for a game type. If no game is provided, the home page is used which returns Live/Upcoming/Recent matches of all available types.
- game: One of the following:
null
,csgo
,dota2
,hearthstone
,hots
,lol
. Defaults tonull
. - page: An integer, string representing an integer, or
null
- callback: Function that takes two parameters:
- error:
null
orString
error message - URLs:
Array
of strings containing full URLs to each match on the page
- error:
Returns a list of URLs from the vod page for a game type. Game is required
- game: One of the following:
csgo
,dota2
,hearthstone
,hots
,lol
. - page: An integer, string representing an integer, or
null
- callback: Function that takes two parameters:
- error:
null
orString
error message - URLs:
Array
of strings containing full URLs to each match on the page
- error:
Given a URL an object containing match information is returned. Matches that are currently live have no datetime
attribute. Matches that have not completed do not have score information. Matches that are live will display the stream URL.
- url: A GosuGamers URL string
- callback: Function that takes two parameters:
- error:
null
orString
error message - match:
Object
of match data
- error:
See the example match data below.
{
url: 'http://www.gosugamers.net/dota2/tournaments/7331-hitbox-eu-championship-3/matches/86826-team-alternate-dota-2-vs-myinsanity',
home:
{ name: 'Team Alternate Dota 2',
url: '/dota2/teams/12074-team-alternate-dota-2',
country: 'Poland',
rank: 62,
score: 2 },
away:
{ name: 'mYinsanity',
url: '/dota2/teams/2820-myinsanity',
country: 'Serbia',
rank: 84,
score: 1 },
vods: ['THEXoAwwmho'],
status: 'Complete',
type: 'dota2',
rounds: 'Best of 3',
valueBet: true,
livestream: 'www.twitch.tv/esea',
datetime: 1440522000
}
Same as parseMatch
except given an array of URLs it returns an array of matches. All matches are requested asynchronously. If you request too many at a time you're likely to be rate-limited and this will fail.
- urls: An
Array
of URLs - callback: Function that takes two parameters:
- error:
null
orString
error message - match:
Array
of objects containing match data
- error: