From 67914d5cdf6548d85d981b2fd43861204f9e5b27 Mon Sep 17 00:00:00 2001 From: zhangxiangliang Date: Fri, 21 Aug 2020 02:07:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20=E9=9B=AA=E7=90=83?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=92=8C=E7=BD=91=E6=98=93=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=82=A1=E7=A5=A8=E4=BB=A3=E7=A0=81=E6=9C=AA?= =?UTF-8?q?=20URL=20=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stocks/netease/index.ts | 2 +- src/stocks/xueqiu/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stocks/netease/index.ts b/src/stocks/netease/index.ts index 35f9ee6..3e028fc 100644 --- a/src/stocks/netease/index.ts +++ b/src/stocks/netease/index.ts @@ -74,7 +74,7 @@ const Netease: StockApi = { */ async searchStocks(key: string): Promise { // 数据获取 - const url = `https://quotes.money.163.com/stocksearch/json.do?type=&count=5&word=${key}&callback=topstock`; + const url = `https://quotes.money.163.com/stocksearch/json.do?type=&count=5&word=${encodeURIComponent(key)}&callback=topstock`; const res = await fetch.get(url); // 解析数据 diff --git a/src/stocks/xueqiu/index.ts b/src/stocks/xueqiu/index.ts index e3ef868..b2cb0b5 100644 --- a/src/stocks/xueqiu/index.ts +++ b/src/stocks/xueqiu/index.ts @@ -93,7 +93,7 @@ const Xueqiu: StockApi & { getToken(): Promise } = { const token = await this.getToken(); // 数据获取 - const url = `https://xueqiu.com/stock/search.json?code=${key}`; + const url = `https://xueqiu.com/stock/search.json?code=${encodeURIComponent(key)}`; const res = await fetch.get(url).set('Cookie', token); const body = JSON.parse(res.text);