Skip to content

Commit

Permalink
fix(egsea): pubDate Invalid Date (#13914)
Browse files Browse the repository at this point in the history
* fix(egsea): pubDate Invalid Date

the https://rsshub.app/egsea/flash response error pubDate

 <pubDate>Invalid Date</pubDate>

* refactor: migrate to v2

---------
  • Loading branch information
defp authored Nov 29, 2023
1 parent c570097 commit 25d9917
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 41 deletions.
2 changes: 1 addition & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
40 changes: 0 additions & 40 deletions lib/routes/egsea/flash.js

This file was deleted.

30 changes: 30 additions & 0 deletions lib/v2/egsea/flash.js
Original file line number Diff line number Diff line change
@@ -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,
};
};
3 changes: 3 additions & 0 deletions lib/v2/egsea/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/flash': ['hillerliao'],
};
13 changes: 13 additions & 0 deletions lib/v2/egsea/radar.js
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions lib/v2/egsea/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/flash', require('./flash'));
};

0 comments on commit 25d9917

Please sign in to comment.