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

steamdb-js

v0.2.2

Published

a library that provides JSON data by scraping steamdb website to get steam games information

Downloads

31

Readme

steamdb-js

a library to get information, prices from all regions, and screenshots of a game as JSON data

Installation

npm i --save steamdb-js

or if you are using yarn:

yarn add steamdb-js

Usage/Example (CommonJS):

const { Game } = require("steamdb-js");

async function main() {
    const game = new Game(271590);
    await game.fetchData();
    const data = await game.parse();
    //console.log(data); // This prints out all parsed data, you can use it for easier in-code usage
    console.log(game.getGameInfo());
}

main();

Usage/Example (+ES5):

import { Game } from "steamdb-js";

async function main() {
    const game = new Game(271590);
    await game.fetchData();
    const data = await game.parse();
    //console.log(data); // This prints out all parsed data, you can use it for easier in-code usage
    console.log(game.getGameInfo());
}

main();

Output (JSON):

{
    "id": 271590,
    "type": "Game",
    "name": "Grand Theft Auto V",
    "developer": "Rockstar North",
    "publisher": "Rockstar Games",
    "os": [
        "Windows"
    ],
    "lastUpdate": 1578987453000,
    "releaseDate": 1428966000000,
    "description":
        "Grand Theft Auto V for PC offers players the option to explore the award-winning world of Los Santos and Blaine County in resolutions of up to 4k and beyond, as well as the chance to experience the game running at 60 frames per second.",
    "logoUrl":
        "https://steamcdn-a.akamaihd.net/steam/apps/271590/header.jpg?t=1578987453"
}

Methods:

class Game {
    /**
    * region is optional and default value is set to `us`
    */
    constructor(gameid: number, region?: string);
    /**
    * fetch game data from steamdb.info website using passed gameid in constructor
    */
    fetchData(): void;
    /**
    * parse all already-fetched data (must be used after calling `fetchData`)
    * @return return value is an object with all parsed data
    */
    parse(): object;
    /**
    * export an array of prices from all regions
    * @Note must be used after `parse()`
    * @return an array of price objects
    */
    getPrices(): Array<{ countryCode: string, currency: string, price: string, convertedPrice: string }>;
    /**
    * export an array of screenshots
    * @Note must be used after `parse()`
    * @return an array of screenshot urls
    */
    getScreenshots(): Array<string>;
    /**
    * export name of the game
    * @Note must be used after `parse()`
    * @return game name
    */
    getName(): string;
    /**
    * export description of the game
    * @Note must be used after `parse()`
    * @return game description
    */
    getDescription(): string;
    /**
    * export logo url of the game
    * @Note must be used after `parse()`
    * @return game logo url
    */
    getLogoUrl(): string;
    /**
    * export game full information
    * @Note must be used after `parse()`
    * @return game info
    */
    getGameInfo(): { name: string, id: number, type: string, description: string, developer: string, publisher: string, lastUpdate: number, releaseDate: number, logoUrl: string };
}

TODO:

  • finish search api, to be able to search using steamdb search engine and get game ids
  • add an api for something like steamdb.info main page, showing stats of trend games