mirror of
https://github.com/zhangxiangliang/stock-api.git
synced 2025-01-23 22:40:21 +08:00
feat: 更换 fetch 数据转换方式
This commit is contained in:
parent
d4d876f534
commit
a2e95ce097
@ -29,7 +29,7 @@ class Netease extends Base {
|
||||
const url = `https://api.money.126.net/data/feed/${transform},money.api?callback=topstock`;
|
||||
const res = await fetch.get(url);
|
||||
|
||||
const items = JSON.parse(res.data.replace(/\(|\)|;|(topstock)/g, ''));
|
||||
const items = JSON.parse(res.body.toString().replace(/\(|\)|;|(topstock)/g, ''));
|
||||
const item = items[transform];
|
||||
|
||||
return {
|
||||
@ -50,7 +50,7 @@ class Netease extends Base {
|
||||
const url = `https://api.money.126.net/data/feed/${transforms.join(',')},money.api?callback=topstock`;
|
||||
const res = await fetch.get(url);
|
||||
|
||||
const items = JSON.parse(res.data.replace(/\(|\)|;|(topstock)/g, ''));
|
||||
const items = JSON.parse(res.body.toString().replace(/\(|\)|;|(topstock)/g, ''));
|
||||
|
||||
return codes.map(code => {
|
||||
const transform = (new NeteaseExchangeTransform).transform(code);
|
||||
|
Loading…
Reference in New Issue
Block a user