* chore: some massive adoption from got().json() to ofetch()
Not sure if everything works fine (some may still have problems other than fakeGot & json issues), but this might have some help.
BTW maybe we can start "The Migration" project to update some outdated routes to new format 🤔
* fix: some other issues
* fix: query
* fix: luogu user blog & modb topic
* fix: modb topic response
* fix: query options in freebuf
---------
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import ofetch from '@/utils/ofetch';
|
|
import { parseDate } from '@/utils/parse-date';
|
|
|
|
const baseUrl = 'https://web.stockedge.com/share/';
|
|
const getData = (url) =>
|
|
ofetch(url, {
|
|
headers: {
|
|
Host: 'api.stockedge.com',
|
|
Origin: 'https://web.stockedge.com',
|
|
Referer: 'https://web.stockedge.com/',
|
|
accept: 'application/json, text/plain, */*',
|
|
},
|
|
});
|
|
|
|
const getList = (data) =>
|
|
data.map((value) => {
|
|
const { ID, Description: title, Date: createdOn, NewsitemSecurities, NewsitemSectors, NewsitemIndustries } = value;
|
|
const securityID = NewsitemSecurities[0].SecurityID;
|
|
return {
|
|
id: ID,
|
|
title: `${title} [${NewsitemSectors.map((v) => v.SectorName).join(', ')}]`,
|
|
description: title,
|
|
securityID,
|
|
link: `${baseUrl}${NewsitemSecurities[0].SecuritySlug}/${securityID}`,
|
|
pubDate: parseDate(createdOn),
|
|
category: [...NewsitemIndustries.map((v) => v.IndustryName), ...NewsitemSectors.map((v) => v.SectorName)],
|
|
};
|
|
});
|
|
|
|
export { getData, getList };
|