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:
lidashuang 2023-11-29 21:41:32 +08:00 committed by GitHub
parent c5700979c3
commit 25d9917d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 41 deletions

View File

@ -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'));

View File

@ -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,
};
};

30
lib/v2/egsea/flash.js Normal file
View File

@ -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,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/flash': ['hillerliao'],
};

13
lib/v2/egsea/radar.js Normal file
View File

@ -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',
},
],
},
};

3
lib/v2/egsea/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/flash', require('./flash'));
};