diff --git a/lib/routes/anigamer/new_anime.js b/lib/routes/anigamer/new_anime.js
index e752fa774..e4fae5d5a 100644
--- a/lib/routes/anigamer/new_anime.js
+++ b/lib/routes/anigamer/new_anime.js
@@ -1,16 +1,23 @@
const axios = require('../../utils/axios');
-const { DateTime } = require('luxon');
module.exports = async (ctx) => {
const { new_anime } = await axios.get('https://api.gamer.com.tw/mobile_app/anime/v1/index.php').then((r) => r.data);
ctx.state.data = {
title: '動畫瘋最後更新',
link: 'https://ani.gamer.com.tw/',
- item: new_anime.date.map((item) => ({
- title: item.title,
- description: item.info,
- link: `https://ani.gamer.com.tw/animeRef.php?sn=${item.anime_sn}`,
- pubDate: DateTime.fromFormat(item.info.split(' ')[0], 'mm/dd').toRFC2822(),
- })),
+ item: new_anime.date.map((item) => {
+ const date = new Date();
+ const month = item.info.split('/')[0] - 1;
+ const day = item.info.split(' ')[0].split('/')[1];
+ const pubdatetemp = new Date(date.getFullYear(), month, day);
+ const pubdate = pubdatetemp > date ? new Date(date.getFullYear() - 1, month, day) : pubdatetemp;
+
+ return {
+ title: item.title,
+ description: item.info,
+ link: `https://ani.gamer.com.tw/animeRef.php?sn=${item.anime_sn}`,
+ pubDate: pubdate.toUTCString(),
+ };
+ }),
};
};
diff --git a/lib/routes/aqk/vul.js b/lib/routes/aqk/vul.js
index d900867d6..1746f0c62 100644
--- a/lib/routes/aqk/vul.js
+++ b/lib/routes/aqk/vul.js
@@ -17,10 +17,12 @@ module.exports = async (ctx) => {
.find('.vul-type-item')
.text()
.replace(/\s+/g, '');
- const date = item
- .find('td:nth-last-child(2)')
- .text()
- .replace(/\s+/g, '');
+ const date = new Date(
+ item
+ .find('td:nth-last-child(2)')
+ .text()
+ .replace(/\s+/g, '')
+ ).toUTCString();
const href = item.find('a').attr('href');
return {
diff --git a/lib/routes/bangumi/group/reply.js b/lib/routes/bangumi/group/reply.js
index ce57c4214..5bcd4ed74 100644
--- a/lib/routes/bangumi/group/reply.js
+++ b/lib/routes/bangumi/group/reply.js
@@ -1,6 +1,5 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
-const DateTime = require('luxon').DateTime;
module.exports = async (ctx) => {
// bangumi.tv未提供获取小组话题的API,因此仍需要通过抓取网页来获取
@@ -38,7 +37,7 @@ module.exports = async (ctx) => {
title: `${c.author}回复了小组话题《${title}》`,
description: c.content,
guid: c.id,
- pubDate: DateTime.fromFormat(c.date, 'yyyy-L-dd HH:mm'),
+ pubDate: new Date(c.date).toUTCString(),
link,
})),
};
diff --git a/lib/routes/bangumi/group/topic.js b/lib/routes/bangumi/group/topic.js
index 78258ba28..bf52112d9 100644
--- a/lib/routes/bangumi/group/topic.js
+++ b/lib/routes/bangumi/group/topic.js
@@ -1,6 +1,5 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
-const DateTime = require('luxon').DateTime;
const resolve_url = require('url').resolve;
const base_url = 'https://bgm.tv/';
@@ -19,7 +18,7 @@ module.exports = async (ctx) => {
.map((_, elem) => ({
link: resolve_url(base_url, $('.subject a', elem).attr('href')),
title: $('.subject a', elem).attr('title'),
- pubDate: DateTime.fromFormat($('.lastpost .time', elem).text(), 'yyyy-L-dd'),
+ pubDate: new Date($('.lastpost .time', elem).text()).toUTCString(),
description: 'Author: ' + $('.author a', elem).text() + '
' + 'Replay: ' + $('.posts', elem).text(),
}))
.get(),
diff --git a/lib/routes/bangumi/person/index.js b/lib/routes/bangumi/person/index.js
index 4c1340b36..696369b06 100644
--- a/lib/routes/bangumi/person/index.js
+++ b/lib/routes/bangumi/person/index.js
@@ -28,7 +28,7 @@ module.exports = async (ctx) => {
title: `${personName}以${c.job}的身份参与了作品《${c.work}》`,
description: c.workInfo,
link: c.workURL,
- pubDate: new Date(c.workInfo.substring(0, c.workInfo.indexOf(' /'))).toUTCString(),
+ pubDate: c.workInfo.substring(0, c.workInfo.indexOf(' /')) === '' ? new Date(0).toUTCString() : new Date(c.workInfo.substring(0, c.workInfo.indexOf(' /'))).toUTCString(),
})),
};
};
diff --git a/lib/routes/bihu/activaties.js b/lib/routes/bihu/activaties.js
index a1b7421b4..1278655af 100644
--- a/lib/routes/bihu/activaties.js
+++ b/lib/routes/bihu/activaties.js
@@ -54,7 +54,7 @@ module.exports = async (ctx) => {
link: itemLink,
author: author,
description: description,
- pubDate: new Date(item.createTime),
+ pubDate: new Date(item.createTime).toUTCString(),
};
return single;
diff --git a/lib/routes/bilibili/audio.js b/lib/routes/bilibili/audio.js
index f0ff3b3ad..5c2a3d061 100644
--- a/lib/routes/bilibili/audio.js
+++ b/lib/routes/bilibili/audio.js
@@ -26,7 +26,7 @@ module.exports = async (ctx) => {
title: title,
link: link,
author: author,
- pubDate: new Date(item.passtime * 1000),
+ pubDate: new Date(item.passtime * 1000).toUTCString(),
description: description,
};
diff --git a/lib/routes/bilibili/userChannel.js b/lib/routes/bilibili/userChannel.js
index 5b250b679..cc81c6287 100644
--- a/lib/routes/bilibili/userChannel.js
+++ b/lib/routes/bilibili/userChannel.js
@@ -35,7 +35,7 @@ module.exports = async (ctx) => {
item: data.archives.map((item) => ({
title: item.title,
description: `${item.desc}`,
- pubDate: new Date(item.fav_at * 1000).toUTCString(),
+ pubDate: new Date(item.pubdate * 1000).toUTCString(),
link: `https://www.bilibili.com/video/av${item.aid}`,
})),
};
diff --git a/lib/routes/fir/update.js b/lib/routes/fir/update.js
index 52b9ee5c3..b0314ccd4 100644
--- a/lib/routes/fir/update.js
+++ b/lib/routes/fir/update.js
@@ -22,7 +22,7 @@ module.exports = async (ctx) => {
item.title = data.app.name + ' ' + data.app.releases.master.version + '(' + data.app.releases.master.build + ')';
item.description = data.app.releases.master.changelog;
item.link = `https://fir.im/x9zu?release_id=${data.app.releases.master.id}`;
- item.pubDate = new Date(data.app.releases.master.created_at * 1000);
+ item.pubDate = new Date(data.app.releases.master.created_at * 1000).toUTCString();
ctx.state.data = {
title: title,
link: webUrl,
diff --git a/lib/routes/galgame/mmgal.js b/lib/routes/galgame/mmgal.js
index 651a917ec..8c96f694d 100644
--- a/lib/routes/galgame/mmgal.js
+++ b/lib/routes/galgame/mmgal.js
@@ -28,11 +28,12 @@ module.exports = async (ctx) => {
const time = `${item.find('.month').text()}${item.find('.day').text()}日`;
const date = new Date();
const math = /(\d+)月(\d+)日/.exec(time);
+ const pubdate = new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2]);
return {
title: item.find('h1').text(),
description: `${item.find('.info p').text()}`,
- pubDate: new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2]).toUTCString(),
+ pubDate: pubdate > date ? new Date(date.getFullYear() - 1, parseInt(math[1]) - 1, math[2]).toUTCString() : pubdate.toUTCString(),
link: item.find('h1 a').attr('href'),
};
})
diff --git a/lib/routes/gitea/blog.js b/lib/routes/gitea/blog.js
index a99cbfa32..caffa5559 100644
--- a/lib/routes/gitea/blog.js
+++ b/lib/routes/gitea/blog.js
@@ -60,7 +60,7 @@ module.exports = async (ctx) => {
title: title,
link: link,
guid: link,
- pubDate: pubDate,
+ pubDate: pubDate.toUTCString(),
description: `
${author}
${desc}`, }; return Promise.resolve(single); diff --git a/lib/routes/miniapp/article.js b/lib/routes/miniapp/article.js index 9c53a53ba..5ecca090e 100644 --- a/lib/routes/miniapp/article.js +++ b/lib/routes/miniapp/article.js @@ -45,7 +45,7 @@ module.exports = async (ctx) => { link: `https://minapp.com/article/${item.id}`, author: item.created_by.nickname, description: item.content, - pubDate: new Date(item.created_at * 1000), + pubDate: new Date(item.created_at * 1000).toUTCString(), })); ctx.state.data = { diff --git a/lib/routes/tieba/forum.js b/lib/routes/tieba/forum.js index dba8861cf..e260bd41e 100644 --- a/lib/routes/tieba/forum.js +++ b/lib/routes/tieba/forum.js @@ -23,7 +23,7 @@ function getPubDate(time) { return new Date(`${year}-${month}-${date} ${time}`); } if (isNormalDate(time)) { - return new Date(`${year}-${time}`); + return new Date(`${year}-${time}`) > now ? new Date(`${year - 1}-${time}`) : new Date(`${year}-${time}`); } if (isDate(time)) { return new Date(time); diff --git a/lib/routes/universities/cas/sim/academic.js b/lib/routes/universities/cas/sim/academic.js index 97983b247..1bd1e0965 100644 --- a/lib/routes/universities/cas/sim/academic.js +++ b/lib/routes/universities/cas/sim/academic.js @@ -55,7 +55,7 @@ module.exports = async (ctx) => { .html() .replace(/src=".\//g, `src="${url.resolve(itemUrl, '.')}`) .trim(), - pubDate: new Date(item.date), + pubDate: new Date(item.date).toUTCString(), }; ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60); return Promise.resolve(single); diff --git a/lib/routes/universities/cczu/jwc.js b/lib/routes/universities/cczu/jwc.js index 3c768a5c5..859b346bf 100644 --- a/lib/routes/universities/cczu/jwc.js +++ b/lib/routes/universities/cczu/jwc.js @@ -28,7 +28,7 @@ module.exports = async (ctx) => { .map((_, elem) => ({ link: url.resolve(pageUrl, elem.attribs.href), title: elem.attribs.title, - pubDate: new Date(elem.attribs.href.replace(entryUrlRegex, '$1-$2-$3')), + pubDate: new Date(elem.attribs.href.replace(entryUrlRegex, '$1-$2-$3')).toUTCString(), })) .get(), }; diff --git a/lib/routes/universities/cczu/news.js b/lib/routes/universities/cczu/news.js index 3b983fcbf..ba7700966 100644 --- a/lib/routes/universities/cczu/news.js +++ b/lib/routes/universities/cczu/news.js @@ -28,7 +28,7 @@ module.exports = async (ctx) => { .map((_, elem) => ({ link: url.resolve(pageUrl, elem.attribs.href), title: elem.attribs.title, - pubDate: new Date(elem.attribs.href.replace(entryUrlRegex, '$1-$2-$3')), + pubDate: new Date(elem.attribs.href.replace(entryUrlRegex, '$1-$2-$3')).toUTCString(), })) .get(), }; diff --git a/lib/routes/universities/hit/jwc.js b/lib/routes/universities/hit/jwc.js index ee6349216..22c1e1896 100644 --- a/lib/routes/universities/hit/jwc.js +++ b/lib/routes/universities/hit/jwc.js @@ -18,7 +18,7 @@ module.exports = async (ctx) => { .first() .text() .replace('[', '') - ), + ).toUTCString(), link: url.resolve(baseUrl, $('a', el).attr('href')), title: $('a', el).attr('title'), })) diff --git a/lib/routes/universities/ju/jwc.js b/lib/routes/universities/ju/jwc.js index 695c01c66..b535b7cf2 100644 --- a/lib/routes/universities/ju/jwc.js +++ b/lib/routes/universities/ju/jwc.js @@ -28,6 +28,7 @@ const map = { module.exports = async (ctx) => { const type = ctx.params.type || 'all'; const link = `${base_url}${map[type]}`; + const date = new Date(); const response = await axios({ method: 'get', @@ -43,10 +44,14 @@ module.exports = async (ctx) => { link: link, title: $('title').text(), item: $('.pg-list>ul>li') + .slice(0, 35) .map((_, elem) => ({ link: resolve_url(link, $('a', elem).attr('href')), title: $('a', elem).text(), - pubDate: new Date($('span.food-time', elem).text()).toUTCString(), + pubDate: + new Date(`${date.getFullYear()}-${$('span.food-time', elem).text()}`) > date + ? new Date(`${date.getFullYear() - 1}-${$('span.food-time', elem).text()}`).toUTCString() + : new Date(`${date.getFullYear()}-${$('span.food-time', elem).text()}`).toUTCString(), })) .get(), }; diff --git a/lib/routes/universities/kmust/job/careers.js b/lib/routes/universities/kmust/job/careers.js index 5a7779b34..df6897674 100644 --- a/lib/routes/universities/kmust/job/careers.js +++ b/lib/routes/universities/kmust/job/careers.js @@ -22,11 +22,10 @@ module.exports = async (ctx) => { item: data.data && data.data.map((item) => { - const { meet_day = '', meet_time = '', company_name = '', school_name = '', address = '', company_property = '', industry_category = '', recommend_time = '', career_talk_id = '' } = item; + const { meet_day = '', meet_time = '', company_name = '', school_name = '', address = '', company_property = '', industry_category = '', career_talk_id = '' } = item; return { title: `【${meet_day} ${meet_time}】${company_name}`, description: `时间:${meet_day} ${meet_time}