简体   繁体   English

我如何在我的网站上有效地加载某人的 Steam 库存和他们每件商品的价格?

[英]How do I efficiently load someone's steam inventory and price of their every item on my website?

I am running Node.js server and I want to load user's inventory so they can see their item and values of each item using JavaScript.我正在运行 Node.js 服务器,我想加载用户的库存,以便他们可以使用 JavaScript 查看他们的项目和每个项目的值。 I have tried to approach this problem by making multiple XHR request.我试图通过发出多个 XHR 请求来解决这个问题。 First request requests user's items and the others are for each item to get their value.第一个请求请求用户的项目,其他请求是为每个项目获取它们的值。 Of course, having this much XMLHttpRequests causes problems, and I am not able to get all of the items displayed if any.当然,拥有这么多 XMLHttpRequests 会导致问题,而且我无法显示所有项目(如果有的话)。 How should I get this working?我应该如何让它工作? Should I store player's inventory instead of loading it every time?我应该存储玩家的物品栏而不是每次都加载它吗? But what if the contents change?但是,如果内容发生变化怎么办? Also, I need to find a way for getting price of each item more efficiently.此外,我需要找到一种更有效地获取每件商品价格的方法。 Should I store prices somewhere in my database?我应该将价格存储在数据库中的某个位置吗?

I'm using following APIs我正在使用以下 API

Get inventory contents: https://steamcommunity.com/profiles/{STEAMID}/inventory/json/730/2 Get price of item: https://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name={ITEM'S MARKET_HASH_NAME}获取库存内容: https ://steamcommunity.com/profiles/{STEAMID}/inventory/json/730/2 获取商品价格: https://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name={项目的MARKET_HASH_NAME}

The market/priceoverview endpoint has a very low rate limit and you probably don't want to call it every time you need the price of an item. market/priceoverview 端点的速率限制非常低,您可能不希望每次需要商品价格时都调用它。 Storing the result in a database is definitely a good start but depending on how many items you want to track that wont be enough.将结果存储在数据库中绝对是一个好的开始,但取决于您要跟踪的项目数量,这还不够。 A good workaround would be to use a third party API.一个好的解决方法是使用第三方 API。 Either use prices from a different marketplace, which provides an API to get the prices for all your item's in a single call or an API which provides cached data from Steam.使用来自不同市场的价格,它提供了一个 API 来在一次调用中获取所有项目的价格,或者使用一个 API,它提供来自 Steam 的缓存数据。 CSGO Trader provides an API which combines prices over the most common marketplaces (including the Steam Market). CSGO Trader提供了一个 API,它结合了最常见的市场(包括 Steam 市场)的价格。 https://prices.csgotrader.app/latest/prices_v6.json hosts a list for all CS:GO Items which is updated every 8 hours. https://prices.csgotrader.app/latest/prices_v6.json托管所有 CS:GO 物品的列表,该列表每 8 小时更新一次。 For Market Data of other app's you depend on Services like SteamApis .对于其他应用程序的市场数据,您依赖于SteamApis等服务。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 "如何显示我的 localStorage 项目中的每个元素?" - How do I display every element from my localStorage item? 如何在我的网站上自动更新以太坊价格 - How can I automatically update ethereum price on my website 如何解析无限制的Steam用户库存 - How to parse steam user inventory without bans 如何将嵌入式播放器集成到我网站的元数据中? - How do I integrate an embedded player into my website's metadata? 如何使Steam API正常工作? - How do I get the steam API to work? 如何在我的网站上添加缩略图,以便当某人在Twitter或Facebook上共享链接时会显示图像和链接? - How do I add a thumbnail to my website so that when someone shares a link on Twitter or Facebook it shows the image and the link? 如何有效地并行加载多个CDNJS / CloudFlare资产? - How do I efficiently load multiple CDNJS/CloudFlare assets in parallel? 我在 componentDidMount 中加载数据,但每次渲染时都会加载数据,我该如何避免这种行为? - I load the data in the componentDidMount but it loads the data every time it's rendered, how do I avoid that behavior? 我如何使用 lodash 检查集合中的每个项目,除了那些不符合我的条件的项目? - How do I use lodash to check every item in a collection except those that dont meet my condition? 在客户端,我该怎么做才能检查是否有人在入侵我的网站? - What can I do, client-side, to check if someone is hacking my website?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM