hitbox-api

0.0.8 • Public • Published

Node.js hitbox.tv API.

Firstly, enter this line at the top of the document, replacing "hb" with whatever you like:

    var hb = require("hitbox-api");

media - (callback) - Returns all the currently live users.

    hb.media(function(err, res, data){
        console.log(data);
    });

mediaUser - (username, callback) - Returns detailed stream information about the given username.

    hb.mediaUser("GamingTom", function(err, res, data){
        console.log(data);
    });

mediaFollowing - (username, callback) - Returns a list of all the currently live people the given username is following.

    hb.mediaFollowing("GamingTom", function(err, res, data){
        console.log(data);
    });

user - (username, callback) - Returns general information about the given username.

    hb.user("GamingTom", function(err, res, data){
        console.log(data);
    });

followers - (username, offset, limit, callback) - Returns a list of the people following the given username.

    hb.followers("GamingTom", "0", "20", function(err, res, data){
        console.log(data);
    });

games - (callback) - Returns a list of all the currently played games, sorted by view count.

    hb.games(function(err, res, data){
        console.log(data);
    });

teams - (callback) - Returns a list of all created teams. (May not work because of the huge amounts of results.)

    hb.teams(function(err, res, data){
        console.log(data);
    });

team - (team, callback) - Returns detailed information about the given team.

    hb.team("hitbox", function(err, res, data){
        console.log(data);
    });

Example usage:

Here is an example to get a list of the people you are following who are live.

hb.mediaFollowing("GamingTom", function(err, res, data){
    if (err == "err01"){
        console.log(err + " - Username does not exist or is not activated.");
    }
    else if (err == "err02"){
        console.log(err + " - No streams online.");
    }
    else if (! err){
        for (var i = 0; i < data.livestream.length; i++) {
            console.log(i+1 + ". - " + data.livestream[i].media_user_name + " - " + data.livestream[i].media_views + " Viewers - " + data.livestream[i].media_status);
        };
    };
});

Error codes:

  • err01 - Username does not exist or is not yet activated.
  • err02 - No followed streamers are currenty online.

Readme

Keywords

Package Sidebar

Install

npm i hitbox-api

Weekly Downloads

9

Version

0.0.8

License

ISC

Last publish

Collaborators

  • gamingtom