我正在使用节点中的请求模块从官方API下载Steam项目的价格。js语言( http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name= )它工作得很好,除非项目的名称以星号()开头,然后url看起来由节点处理 http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=â %20M9%20Bayonet%20%7C%20Stained%20(Field-Tested) 。当手动将其键入浏览器时,效果很好,但当我的Steam机器人执行此操作时,Steam会返回 {"success":"false"} 。我认为它不通过星号()的原因是,我应该如何修复它?
http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=â %20M9%20Bayonet%20%7C%20Stained%20(Field-Tested)
{"success":"false"}
完全URL编码 market_hash_name 在将其传递给 request 图书馆
market_hash_name
request
request = require("request") request("http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=%e2%98%85+M9+Bayonet+%7c+Stained+(Field-Tested)", function(e, response, body) { console.log(body) });