fix(route): sina responsed 403 (#9304)
* fix(route): sina responsed 403 * fix: use parseDate fix: promise overhead
This commit is contained in:
parent
727f17a15f
commit
e50dc7058e
|
|
@ -1,8 +1,13 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got.get(`https://feed.mix.sina.com.cn/api/roll/get?pageid=372&lid=2431&k=&num=50&page=1&r=${Math.random()}&callback=&_=${new Date().getTime()}`);
|
||||
const response = await got(`https://feed.mix.sina.com.cn/api/roll/get?pageid=372&lid=2431&k=&num=50&page=1&r=${Math.random()}&callback=&_=${new Date().getTime()}`, {
|
||||
headers: {
|
||||
Referer: 'https://tech.sina.com.cn/',
|
||||
},
|
||||
});
|
||||
const list = response.data.result.data;
|
||||
|
||||
const out = await Promise.all(
|
||||
|
|
@ -22,9 +27,9 @@ module.exports = async (ctx) => {
|
|||
title,
|
||||
link,
|
||||
description,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
pubDate: parseDate(date),
|
||||
};
|
||||
return Promise.resolve(single);
|
||||
return single;
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue