Skip to content

Commit

Permalink
chore: enhance pubDate format and filter recent items in sina/finance.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Soontao committed Jan 11, 2025
1 parent 5b33151 commit fccfe88
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/rss-server/routes/sina/finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = async (ctx) => {
const response = await got.get(url);
const list = response.data.result.data;

const out = await Promise.all(
let out = await Promise.all(
list.map(async (data) => {
const title = data.title;
const link = data.url;
Expand All @@ -32,12 +32,14 @@ module.exports = async (ctx) => {
description: $("#artibody").html(),
author: $(".source.ent-source").text(),
// 2020年08月31日 12:56
pubDate: moment(sDate, "YYYY年MM月DD日 hh:mm"),
pubDate: moment(sDate, "YYYY年MM月DD日 hh:mm").toISOString(),
};
});
}),
);

out = out.filter(item => moment(item.pubDate).isBefore(moment().subtract(15, 'minutes')))

ctx.state.data = {
title: "新浪财经-国內",
link: "http://finance.sina.com.cn/china/",
Expand Down

0 comments on commit fccfe88

Please sign in to comment.