无法使用请求模块处理 url

Can't process url with request module

我正在使用 node.js (http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=) 中的请求模块从官方 API 下载 Steam 物品的价格,它工作得很好,除非物品的名称以星号(★),那么url看起来节点处理的是http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=★%20M9%20Bayonet%20%7C%20Stained%20(Field-Tested)。当手动输入到浏览器时它运行良好,但当我的 Steam 机器人这样做时,Steam returns {"success":"false"}。我觉得是没有通过星号(★)的原因,我应该怎么解决?

在将 market_hash_name 传递给 request 库之前对其进行完整的 URL 编码。

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)
});