我在加拿大的一个服务器上托管了一个不一致的机器人。当我这样做的时候
let response = await fetch("http://store.steampowered.com/api/appdetails?appids=251570")在计算机辅助设计中,我得到一个带有price_overview信息的响应。我想要美元,因为我在美国。有没有办法得到USD的回应而不是CAD的回应?(最好不要只做数学运算将CAD转换为USD)
发布于 2021-07-12 17:58:58
您可以在URL后面附加&cc=us&l=en,以获得以美元为单位的价格:
https://store.steampowered.com/api/appdetails?appids=251570&cc=us&l=en
这会产生:
price_overview: {
currency: "USD",
initial: 2499,
final: 2499,
discount_percent: 0,
initial_formatted: "",
final_formatted: "$24.99"
},所以在你的代码中:
let response = await fetch("https://store.steampowered.com/api/appdetails?appids=251570&cc=us&l=en")注意:这是一个非官方的API,可以随时更改。
https://stackoverflow.com/questions/68341442
复制相似问题