@dsyncerek/node-steam-prices
v3.0.0
Published
MongoDB collection with Steam prices.
Downloads
14
Readme
Steam Prices for Node.js
MongoDB collection with Steam prices.
Installation
npm i @dsyncerek/node-steam-prices
Configuration
const SteamPrices = module.exports('your mongodb connection url', {
interval: 8, // update every 8 hours
tableName: 'steam_items'
});
You need to provide function that transforms api resopnse to array of items with name
and price
property.
SteamPrices.addProvider('https://api.csgofast.com/price/all', data => {
let _ret = [];
for (let p in data) if (data.hasOwnProperty(p)) _ret.push({name: p, price: data[p]});
return _ret;
});
SteamPrices.addProvider('https://api.opskins.com/IPricing/GetAllLowestListPrices/v1/?appid=730', data => {
data = data.response;
let _ret = [];
for (let p in data) if (data.hasOwnProperty(p)) _ret.push({name: p, price: data[p].price / 100});
return _ret;
});
prices.update();
Usage
SteamPrices.getItem('AWP | Dragon Lore (Factory New)').then(data => console.log(data));