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

csgofloat

v4.0.0

Published

Source Code that Powers the CSGOFloat API

Downloads

16

Readme

GitHub stars GitHub forks GitHub issues GitHub license Website Chrome Web Store Docker

CSGOFloat is a free and open source API service that allows you to obtain the float and paint seed of any CSGO item using its inspect link.

Repo Links

CSGOFloat-Extension

CSGOFloat-Website

Table of Contents

API

!! If you want to heavily use the public API, please host this repo yourself !!

https://api.csgofloat.com

GET /

Parameters s, a, d, m can be found in the inspect link of a csgo item.

| Parameter | Description | |:-------------:|:-------------| | s | Optional: If an inventory item, fill out this parameter from the inspect URL | | a | Required: Inspect URL "a" param | | d | Required: Inspect URL "d" param | | m | Optional: If a market item, fill out this parameter from the inspect URL |

Examples

https://api.csgofloat.com/?m=563330426657599553&a=6710760926&d=9406593057029549017

https://api.csgofloat.com/?s=76561198084749846&a=6777992090&d=3378412659870065794

GET / (Using an Inspect URL)

| Parameter | Description | |:-------------:|:-------------| | url | Required: Inspect URL of the CSGO item |

Examples

https://api.csgofloat.com/?url=steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198084749846A698323590D7935523998312483177

https://api.csgofloat.com/?url=steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M625254122282020305A6760346663D30614827701953021

Reply

The reply of this API is based upon this CSGO protobuf.

| Attribute | Data Type | Description | |:-------------:|:-------------:|:--------------| | itemid | uint32 | Item ID | | defindex | uint32 | Weapon ID | | paintindex | uint32 | Paint ID of the weapon (skin) | | rarity | uint32 | Rarity value of the weapon | | quality | uint32 | Quality of the weapon | | paintwear | uint32 | Wear of the exterior of the skin | | paintseed | uint32 | Seed for the RNG that defines how to place the skin texture | | killeatervalue | uint32 | If the item is StatTrak, this is the amount of kills | | customname | string | If the item has a nametag, this is the custom name | | stickers | array | Contains data on the placement of stickers | | origin | uint32 | Origin ID of the weapon | | floatvalue | float | Exterior wear of the skin in its float representation | | imageurl | string | Optional: Image of the item | | min | float | Minimum wear of the skin | | max | float | Maximum wear of the skin | | item_name | uint32 | Optional: Name of the skin | | weapon_type | string | Weapon type name | | origin_name | string | Origin name (Trade-Up, Dropped, etc...) | | quality_name | string | Quality name (Souvenir, Stattrak, etc...) | | rarity_name | string | Rarity name (Covert, Mil-Spec, etc...) | | wear_name | string | Wear name (Factory New, Minimal Wear, etc...) | | full_item_name | string | Full Item Name (ex. SSG 08 Blue Spruce (Minimal Wear)) |

{
	"iteminfo": {
		"accountid": null,
		"itemid": "13874827217",
		"defindex": 7,
		"paintindex": 282,
		"rarity": 5,
		"quality": 4,
		"paintseed": 361,
		"killeaterscoretype": null,
		"killeatervalue": null,
		"customname": null,
		"stickers": [],
		"inventory": 11,
		"origin": 8,
		"questid": null,
		"dropreason": null,
		"musicindex": null,
		"s": "0",
		"a": "13874827217",
		"d": "4649025583329100061",
		"m": "2608048286785948758",
		"floatvalue": 0.22740158438682556,
		"imageurl": "http://media.steampowered.com/apps/730/icons/econ/default_generated/weapon_ak47_cu_ak47_cobra_light_large.7494bfdf4855fd4e6a2dbd983ed0a243c80ef830.png",
		"min": 0.1,
		"max": 0.7,
		"weapon_type": "AK-47",
		"item_name": "Redline",
		"rarity_name": "Classified",
		"quality_name": "Unique",
		"origin_name": "Found in Crate",
		"wear_name": "Field-Tested",
		"full_item_name": "AK-47 | Redline (Field-Tested)"
	}
}

POST /bulk

Allows you to request the inspect link data for multiple items at once.

NOTE: Ensure that you send proper Content-Type: application/json headers

Request Body:

{
	"links": [
		{"link": "steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M2906459769049600931A18971892678D9403672490970763167"},
		{"link": "steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M2907585668964658722A17231546984D5353704955732169451"}
	]
}

Example Response:

{
    "18971892678": {
        "origin": 8,
        "quality": 4,
        "rarity": 5,
        "a": "18971892678",
        "d": "9403672490970763167",
        "paintseed": 49,
        "defindex": 7,
        "paintindex": 282,
        // STUB...
    },
    "17231546984": {
        "origin": 4,
        "quality": 4,
        "rarity": 4,
        "a": "17231546984",
        "d": "5353704955732169451",
        "paintseed": 597,
        "defindex": 9,
        "paintindex": 838,
        // STUB...
    },
    ...
}

GET /stats

Gives some data on the current status of your bots and queue.

Example:

{"bots_online":100,"bots_total":100,"queue_size":20,"queue_concurrency":100}

Errors

Error Codes

| Code | Description | |:-------------:|:-------------| | 1 | Improper Parameter Structure | | 2 | Invalid Inspect Link Structure | | 3 | You may only have X pending request(s) at a time | | 4 | Valve's servers didn't reply in time | | 5 | Valve's servers appear to be offline, please try again later! | | 6 | Something went wrong on our end, please try again | | 7 | Improper body format | | 8 | Bad Secret |

Example Error
{
	"error": "Valve's servers didn't reply in time",
	"code": 4
}

If using a /bulk request and the error only applies to a specific inspect link, the returned response for it will be replaced while other inspect links will be processed normally. If the error applies to the entire request (ie. bad post body), it will return a root-level error as shown above.

Example:

{
    "18971892678": {
        "origin": 8,
        "quality": 4,
        "rarity": 5,
        "a": "18971892678",
        "d": "9403672490970763167",
        "paintseed": 49,
        "defindex": 7,
        "paintindex": 282,
        // STUB...
    },
    "16231546984": {
        "error": "Valve's servers didn't reply in time",
        "code": 4,
        "status": 500
    }
}

How to Install

In order to retrieve float values for weapons in this way, you must have Steam account(s) with a copy of CS:GO. Each account can request 1 float per second. CSGOFloat allows you to have as many bots as you'd like by inputting the login info into config.js.

Each instance of CSGOFloat can operate around 300 accounts. It is recommended to either configure a Postgres server or setup another cache such as Varnish or Nginx in front of your server.

Docker

Pull the image from docker and mount the config directory

docker pull step7750/csgofloat:latest
docker run -d --name csgofloat -v /host/config:/config -p 80:80 -p 443:443 step7750/csgofloat:latest

The first time you start the docker container, it'll copy the config.js file to the config directory and stop. You'll need to edit this file and include your bots login information and then start the docker again. See the section How to First Login a Bot for further info.

Manual

Requires Node.js v8+!

Clone the repo (or npm install csgofloat) and install the Node.js dependencies using npm install or yarn install in the root directory.

Steps:

  1. Copy config.example.js to config.js
  2. Add your bot(s) login information to config.js
  3. Edit config.js with your desired settings
  4. Ensure Postgres is running if you've set it's database url
  5. Run node index.js in the main directory
  6. How to First Login a Bot
  7. Navigate to the IP that the server is hosted on and query the API using the docs above!

How to First Login a Bot

Note: If the bot has never logged into the steam client before and doesn't have Mobile 2FA enabled (fresh account), you can just input the username and password and it should successfully log in without email 2FA

If your bot doesn't own CS:GO, CSGOFloat will automatically try to obtain a license for it during startup.

  • Using Email 2FA
    • Only fill in the user and pass fields for the bot (make sure the auth field is empty or removed)
    • Start up CSGOFloat
    • It will tell you that an auth code was sent to your email
    • Input the code from your email into the auth field for the bot
    • Restart CSGOFloat
    • It should successfully login and create a sentry file in the current node-steam-user config directory
    • The auth field can now be optionally removed in your login file for further logins
  • Using Mobile 2FA
    • Fill in the user and pass fields for the bot
    • Fill in the auth field with the shared_secret for the bot
    • Start up CSGOFloat
    • It should successfully login and create a sentry file in the current node-steam-user config directory
    • You'll need to keep the auth field filled in for future logins

Breaking Changes

v3.0 -> v4.0

  • MongoDB is no longer supported, use Postgres instead
  • Socket.io access is no longer supported
  • Built-in HTTPS handling has been removed, reverse proxy to HTTP instead

v2.0 -> v3.0

  • Since we now use node-steam-user instead of node-steam, the sentry folder location now depends on your system. If you'd like to migrate sentry files from v2.0 rather than having to reauthenticate email 2FA accounts, you'll need to copy your sentry files and rename them to match node-steam-user's format
  • allow_simultaneous_requests has now been replaced by max_simultaneous_requests. You can set max_simultaneous_requests to -1 to allow an infinite amount of simultaneous requests by the same IP.

Args

-c/--config (default ./config.js)

CSGOFloat config file location

-s/--steam_data (default node-steam-user config directory)

node-steam-user config directory