Skip to content

SteamCardExchange.net unofficial REST API server (scraper).

Notifications You must be signed in to change notification settings

man90es/steamcardexchange-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SteamCardExchange-API

SteamCardExchange.net is a service that allows its users to safely exchange their Steam Trading Cards for virtual currency and vice versa. This repository contains the source code for an unofficial REST API server. It relies on web scraping and allows you to easily access such data as the number of cards in stock, how much currency you can get from turning them in and how much they cost to buy.

Building and running

  1. Clone the repository;
  2. From the root directory of the cloned repository, run pnpm install to install the dependencies (you can also use NPM or Yarn);
  3. Run pnpm build to transpile the code;
  4. Run pnpm start to start the server.

Configuration

By default, the server starts on port 8002. If the aforementioned port is taken by another process, it will exit with an error. You can configure it to use another port (e.g. 8003) in one of two ways:

  • Set the environment variable by hand: PORT=8003 pnpm start;
  • Copy existing ".env.template" file into ".env", change the contents to PORT=8003 and then execute pnpm start.

Usage

Send GET requests to http:https://127.0.0.1:8002/apps/570, where:

  • 127.0.0.1 is the IP address of your server (leave it as is if it's hosted locally);
  • 8002 is the port that you configured (leave it as is if you didn't configure anything);
  • 570 is the ID of a game on Steam that you're interested in.

You can get game IDs from the URIs of their store pages. E.g, Dota 2 (URI: https://store.steampowered.com/app/570/Dota_2) has ID 570 which is used in this example.

Here's an example of how the responce may look:

[
	{ "name": "Bounty Hunter", "amount": 1, "worth": 5, "price": 8 },
	{ "name": "Phantom Lancer", "amount": 4, "worth": 5, "price": 5 },
	{ "name": "Razor", "amount": 7, "worth": 5, "price": 5 },
	{ "name": "Riki", "amount": 0, "worth": 5 },
	{ "name": "Tidehunter", "amount": 8, "price": 5 },
	{ "name": "Tiny", "amount": 1, "worth": 5, "price": 8 },
	{ "name": "Tusk", "amount": 8, "price": 5 },
	{ "name": "Vengeful Spirit", "amount": 8, "price": 5 }
]

Response explanation:

Property Possible values Meaning
name Any string The title of the card
amount Any integer The number of cards that SteamCardExchange holds
worth Any integer How much credits you get for turning this card in. Property doesn't exist if you can't turn the card in
price Any integer How much credits getting the card will cost you. Property doesn't exist if you can't buy this card