New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

steamgrab

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steamgrab

A TypeScript library for scraping game information from Steam

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Steam Game Scraper (steamgrab)

A TypeScript library for fetching game information from the Steam store. This library provides easy-to-use functions for searching games by name and retrieving detailed game information by Steam App ID.

Features

  • Search for games by name and get multiple results
  • Fetch detailed game information using Steam App ID
  • TypeScript support with full type definitions
  • Modern async/await API
  • Error handling with custom error types
  • Compatible with Node.js 16+ and modern browsers

Installation

npm install steamgrab
# or
yarn add steamgrab
# or
bun add steamgrab

This package is distributed as TypeScript source files rather than compiled JavaScript, which provides several benefits:

  • Better type information directly from the source
  • Easier debugging with source maps
  • Ability to adapt the code to your TypeScript configuration

Note that you'll need TypeScript ≥4.5.0 in your project to use this package.

Usage

Searching for games

import { Steam } from 'steamgrab';

async function searchGames() {
  try {
    // Get up to 10 games matching "Portal"
    const games = await Steam.getGames('Portal');
    
    console.log(`Found ${games.length} games:`);
    games.forEach(game => {
      console.log(`${game.title} (${game.appid}) - ${game.price}`);
    });
  } catch (error) {
    if (error instanceof Steam.SteamScraperError) {
      console.error('Steam scraper error:', error.message);
    } else {
      console.error('Error:', error);
    }
  }
}

searchGames();

Getting game details by App ID

import { Steam } from 'steamgrab';

async function getGameDetails(appId: number) {
  try {
    const game = await Steam.getGameInfoById(appId);
    
    if (game) {
      console.log(`Title: ${game.title}`);
      console.log(`Release Date: ${game.release}`);
      console.log(`Price: ${game.price}`);
      console.log(`Image URL: ${game.image}`);
    } else {
      console.log(`No game found with AppID: ${appId}`);
    }
  } catch (error) {
    if (error instanceof Steam.SteamScraperError) {
      console.error('Steam API error:', error.message);
    } else {
      console.error('Error:', error);
    }
  }
}

// Get details for Portal 2 (App ID: 620)
getGameDetails(620);

API Reference

getGames(query: string, limit?: number): Promise<GameInfo[]>

Searches for games by name and returns an array of game information.

  • query: The game name to search for
  • limit: Maximum number of results to return (default: 10)

getFirstGameInfo(query: string): Promise<GameInfo | null>

Fetches the first game information result by searching for a game name.

  • query: The game name to search for

Note: This function is deprecated. Use getGames(query, 1) instead.

getGameInfoById(appId: string | number): Promise<GameInfo | null>

Fetches game information directly using the Steam API with a game ID.

  • appId: The Steam app ID of the game

GameInfo Interface

interface GameInfo {
  title: string;
  release: string;
  price: string;
  image: string | undefined;
  appid: number | undefined;
}

Development

# Clone the repository
git clone https://github.com/RedWilly/steamgrab.git
cd steamgrab

# Install dependencies
npm install

# Build the library
npm run build

# Run tests
npm test

License

MIT

Keywords

steam

FAQs

Package last updated on 06 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts