All Projects β†’ Step7750 β†’ node-csgo-cdn

Step7750 / node-csgo-cdn

Licence: MIT license
Retrieves the Steam CDN Image URLs for CS:GO Items

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-csgo-cdn

CSGO-Config-Presets
πŸŽ‰β€‹ Presets of Config files for many scenarios in CS:GO
Stars: ✭ 167 (+227.45%)
Mutual labels:  csgo
toy-arms
βš”οΈ my simple reusable game hack components in Rust
Stars: ✭ 71 (+39.22%)
Mutual labels:  csgo
php-proxy
php proxy based on GoAgent protocal,Implemented by golang
Stars: ✭ 85 (+66.67%)
Mutual labels:  cdn
powered-cache
The most powerful caching and performance suite for WordPress.
Stars: ✭ 31 (-39.22%)
Mutual labels:  cdn
go-cdn
No description or website provided.
Stars: ✭ 18 (-64.71%)
Mutual labels:  cdn
bot-whatsapp
Unmaintained - Multipurpose WhatsApp Bot πŸ€– using open-wa/wa-automate-nodejs library! ✨
Stars: ✭ 78 (+52.94%)
Mutual labels:  stickers
csgo-maps-overviews
Counter-Strike Global Offensive maps overviews generated from game files (used by the radar)
Stars: ✭ 47 (-7.84%)
Mutual labels:  csgo
csgo-cli
CS:GO Console shows your user account, stats and latest matches. It also uploads demo sharecodes to csgostats.gg.
Stars: ✭ 31 (-39.22%)
Mutual labels:  csgo
csgo-fake-opening
Fake opening for csgo
Stars: ✭ 88 (+72.55%)
Mutual labels:  csgo
flutter-p2p-engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 93 (+82.35%)
Mutual labels:  cdn
vsc-markdown-image
Easy to insert a image to markdown
Stars: ✭ 140 (+174.51%)
Mutual labels:  cdn
LaColorduino
I build my own clone of "LaMetric"-smartwatch but with some Colorduino for Twitch, YouTube, Twitter, CSGO, etc.. (Working)
Stars: ✭ 56 (+9.8%)
Mutual labels:  csgo
uploadcare-ios
UploadcareKit: iOS SDK for Uploadcare API
Stars: ✭ 24 (-52.94%)
Mutual labels:  cdn
Boundary
Boundary is a CSS+Javascript library for Chrome extension developers to easily create HTML elements that won’t affect or be affected by the current webpage’s CSS. Strongly recommended if you are considering adding a sticker, a sidebar or any overlay box using content script.
Stars: ✭ 59 (+15.69%)
Mutual labels:  stickers
API
API for SQLMatches.
Stars: ✭ 48 (-5.88%)
Mutual labels:  csgo
sqproxy
Offloading Source Engine query packets (A2S) handling. Rate limits, statistics, customization
Stars: ✭ 30 (-41.18%)
Mutual labels:  csgo
freecdn
A front-end CDN based on ServiceWorker
Stars: ✭ 850 (+1566.67%)
Mutual labels:  cdn
frag-finder
Takes JSON files exported from CS:GO Demos Manager and spits out readable highlights meant as helpful filenames for fragmovie recording.
Stars: ✭ 22 (-56.86%)
Mutual labels:  csgo
sourcepawn-navmesh
SourcePawn .NAV file reader.
Stars: ✭ 25 (-50.98%)
Mutual labels:  csgo
WebEssentials.AspNetCore.CdnTagHelpers
A CDN helper for ASP.NET Core
Stars: ✭ 44 (-13.73%)
Mutual labels:  cdn

node-csgo-cdn

Retrieves the Steam CDN URLs for CS:GO Item Images from their market_hash_name or properties.

Can retrieve CDN images for:

  • Stickers
  • Characters
  • Graffiti (without tint)
  • Weapons (and doppler phases)
  • Music Kits
  • Tools (Crate Keys, Cases, Stattrak Swap Tool, etc...)
  • Status Icons (Pins, ESports Trophies, Map Contribution Tokens, Service Medals, etc...)

Table of Contents

Why?

Steam hosts all of the CS:GO resource images on their CDN, but unfortunately finding the URL for them was difficult in the past and would require scraping the market or inventories.

This library allows you to retrieve the needed CDN URLs given the sticker name, which can save you lots in bandwidth and prevents you from having to scrape it or host it yourself.

How?

Most of the graphical resources for CSGO are stored in VPK files which include the sticker, music kit, tools, and status icon images.

The root of a VPK contains a dir file (pak01_dir.vpk) that specifies where files are located over multiple packages. If you look in the install directory of CS:GO, you'll see pak01_003.vpk, pak01_004.vpk, etc... where these files are located.

Thankfully, Valve was kind enough (as of writing this) to include all of the relevant images in a few packages which are only ~400MB.

This library, using node-steam-user, checks the manifest for any updates to the public branch of CS:GO, and if so, downloads only the required VPK packages that contain all relevant images if they have changed from the content servers.

When trying to retrieve a CDN image URL for a given item, the library takes the SHA1 hash of the file and the VPK path that links to it to generate the corresponding URL.

Example URL: https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/cologne2015/mousesports.3e75da497d9f75fa56f463c22db25f29992561ce.png

How to Install

npm install csgo-cdn

See example.js

const SteamUser = require('steam-user');
const csgoCDN = require('csgo-cdn');

const user = new SteamUser();
const cdn = new csgoCDN(user, {logLevel: 'debug'});

cdn.on('ready', () => {
   console.log(cdn.getItemNameURL('M4A4 | ιΎηŽ‹ (Dragon King) (Field-Tested)'));
   console.log(cdn.getItemNameURL('β˜… Karambit | Gamma Doppler (Factory New)', cdn.phase.emerald));
});

Methods

Constructor(client, options)

  • client - node-steam-user Client The account MUST own CS:GO
  • options - Options
    {
        directory: 'data', // relative data directory for VPK files
        updateInterval: 30000, // seconds between update checks, -1 to disable auto-updates
        logLevel: 'info', // logging level, (error, warn, info, verbose, debug, silly)
        stickers: true, // whether to obtain the vpk for stickers
        patches: true, // whether to obtain the vpk for patches
        graffiti: true, // whether to obtain the vpk for graffiti
        musicKits: true, // whether to obtain the vpk for music kits
        cases: true, // whether to obtain the vpk for cases
        tools: true, // whether to obtain the vpk for tools
        statusIcons: true, // whether to obtain the vpk for status icons
    }

getItemNameURL(marketHashName, phase)

  • marketHashName - The market hash name of an item (ex. "Sticker | Robo" or "AWP | Redline (Field-Tested)")
  • phase - Optional weapon phase for doppler skins from the phase enum property

Note: If the item is a weapon, you can omit the wear (ex. AWP | Redline)

Ensure that you have enabled the relevant VPK downloading for the item category by using the options in the constructor.

Returns the 'large' version of the image.

getStickerURL(stickerName, large=true)

  • stickerName - Name of the sticker path from items_game.txt (ex. cluj2015/sig_olofmeister_gold)
  • large - Whether to obtain the large version of the image

getPatchURL(patchName, large=true)

  • stickerName - Name of the patch path from items_game.txt (ex. case01/patch_phoenix)
  • large - Whether to obtain the large version of the image

getWeaponURL(defindex, paintindex)

  • defindex - Definition index of the item (ex. 7 for AK-47)
  • paintindex - Paint index of the item (ex. 490 for Frontside Misty)

Properties

itemsGame

Parsed items_game.txt file as a dictionary

csgoEnglish

Parsed csgo_english file as a dictionary. Also contains all inverted keys, such that the values are also keys themselves for O(1) retrieval.

itemsGameCDN

Parsed items_game_cdn.txt file as a dictionary

phase

Doppler phase enum used to specify the phase of a knife

cdn.getItemNameURL('β˜… Karambit | Gamma Doppler (Factory New)', cdn.phase.emerald);
cdn.getItemNameURL('β˜… Huntsman Knife | Doppler (Factory New)', cdn.phase.blackpearl);
cdn.getItemNameURL('β˜… Huntsman Knife | Doppler (Factory New)', cdn.phase.phase1);
cdn.getItemNameURL('β˜… Flip Knife | Doppler (Minimal Wear)', cdn.phase.ruby);
cdn.getItemNameURL('β˜… Flip Knife | Doppler (Minimal Wear)', cdn.phase.sapphire);

Events

ready

Emitted when csgo-cdn is ready, this must be emitted before using the object

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].