fix(egsea): pubDate Invalid Date (#13914)
* fix(egsea): pubDate Invalid Date the https://rsshub.app/egsea/flash response error pubDate <pubDate>Invalid Date</pubDate> * refactor: migrate to v2 ---------
This commit is contained in:
parent
c5700979c3
commit
25d9917d5f
|
|
@ -171,7 +171,7 @@ router.get('/wikipedia/mainland', lazyloadRouteHandler('./routes/wikipedia/mainl
|
|||
router.get('/un/scveto', lazyloadRouteHandler('./routes/un/scveto'));
|
||||
|
||||
// e 公司
|
||||
router.get('/egsea/flash', lazyloadRouteHandler('./routes/egsea/flash'));
|
||||
// router.get('/egsea/flash', lazyloadRouteHandler('./routes/egsea/flash'));
|
||||
|
||||
// 选股宝
|
||||
router.get('/xuangubao/subject/:subject_id', lazyloadRouteHandler('./routes/xuangubao/subject'));
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://www.egsea.com/news/flash-list?per-page=30`,
|
||||
headers: {
|
||||
Referer: `https://www..com/news/flash`,
|
||||
},
|
||||
});
|
||||
|
||||
const newsflashes = response.data.data;
|
||||
|
||||
let newsflashesList = [];
|
||||
for (let i = 0; i < newsflashes.length; i++) {
|
||||
newsflashesList = newsflashesList.concat(newsflashes[i]);
|
||||
}
|
||||
|
||||
const out = newsflashesList.map((item) => {
|
||||
const pubDate = item.pageTime;
|
||||
const link = 'https://www.egsea.com' + item.url;
|
||||
const title = item.title;
|
||||
const description = item.content;
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link,
|
||||
pubDate,
|
||||
description,
|
||||
};
|
||||
|
||||
return single;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `快讯 - e 公司`,
|
||||
link: `https://www.egsea.com/news/flash`,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.egsea.com/news/flash-list?per-page=30',
|
||||
});
|
||||
|
||||
const out = response.data.data.map((item) => {
|
||||
const pubDate = parseDate(item.pageTime, 'X');
|
||||
const link = 'https://www.egsea.com' + item.url;
|
||||
const title = item.title;
|
||||
const description = item.content;
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
pubDate,
|
||||
description,
|
||||
category: item.tags.map((tag) => tag.name),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: '快讯 - e 公司',
|
||||
link: 'https://www.egsea.com/news/flash',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/flash': ['hillerliao'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'egsea.com': {
|
||||
_name: 'e 公司',
|
||||
'.': [
|
||||
{
|
||||
title: '快讯',
|
||||
docs: 'https://docs.rsshub.app/routes/new-media#e-gong-si',
|
||||
source: ['/news/flash'],
|
||||
target: '/egsea/flash',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/flash', require('./flash'));
|
||||
};
|
||||
Loading…
Reference in New Issue