npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@akashagrahari/dota-liquipedia-api-client

v1.0.7

Published

An API client to read data from Liquipedia for the video game Dota

Downloads

11

Readme

Dota 2 Liquipedia API Client

An API client to read data from the Liquipedia Wiki for the video game Dota 2. Currently it can retrieve teams and matches (upcoming, live or all).

Installation

Install the Dota 2 Liquipedia API Client via npm or your package manager of choice

npm i --save dota-liquipedia-api-client

How To Use

Import the main client file and class, create an instance and initialise it with your User Agent name

import DotaLiquipediaClient from 'dota-liquipedia-api-client';

const client = new DotaLiquipediaClient('MyUserAgent');

You can then use this to make any of the calls required for your purposes.

All API functions return a Promise, and therefore can be used through either the traditional Promise mechanism, or with the await syntax.

Teams

The data structure(s) for teams look like the following:

type ITeamMember = {
    nickname: string;
    fullName: string;
    joinDate: Date;
    position: string;
}

type ITeam = {
    name: string;
    roster: ITeamMember[];
    region: string;
    captain?: string;
}

You can retrieve any team by name how the page would be named on the Liquipedia Wiki, without underscores (i.e. "Team Liquid", "OG")

client.getTeamByName("Team Liquid").then(team => {
    console.log(team);
}).catch(error => {
    console.log(error);
});

Matches

The data structure(s) for matches look like the following:

type IMatchTeam = {
    name: string;
    shortName?: string;
    currentScore?: number;
}

enum MatchStatus {
    Upcoming,
    Live,
    Completed
}

type IMatch = {
    homeTeam: IMatchTeam;
    awayTeam: IMatchTeam;
    bestOf: number;
    status: MatchStatus;
    startTime?: Date;
    twitchStream?: string;
    tournamentName?: string;
}

All matches (live & upcoming) can be retrieved using the following function.

client.getMatches().then(matches => {
    console.log(matches);
}).catch(error => {
    console.log(error);
});

Only upcoming matches can be retrieved using the following function.

client.getUpcomingMatches().then(matches => {
    console.log(matches);
}).catch(error => {
    console.log(error);
});

Only live matches can be retrieved using the following function.

client.getLiveMatches().then(matches => {
    console.log(matches);
}).catch(error => {
    console.log(error);
});

Usage Notes

Please note that this uses the Dota 2 Liquipedia Wiki and you should use it in accordance with their API terms of use which you can find from here.

This library uses the "parse" actions for all calls, so you should be aware not to use these requests more than once per 30 seconds. Remember to cache results from the API calls to avoid recurring calls to the Liquipedia API.

Please remember to also attribute the data & content you're using to Liquipedia under the CC-BY-SA 3.0 license as described here.