fix(route): 日本经济新闻中文版新闻全文 (#12515)

This commit is contained in:
Ethan Shen
2023-05-16 00:59:39 +08:00
committed by GitHub
parent e0bab7618b
commit 7ffa6b295c
+2 -2
View File
@@ -30,7 +30,7 @@ module.exports = async (ctx) => {
officialFeed = await parser.parseURL(currentUrl);
items = officialFeed.items.slice(0, limit).map((item) => ({
title: item.title,
link: `${rootUrl}/x-columnviewpoint/${item.link.match(/\/([\d-]+\.html)/)[1]}`,
link: new URL(item.attr('href'), rootUrl).href,
}));
} else {
const response = await got({
@@ -47,7 +47,7 @@ module.exports = async (ctx) => {
return {
title: item.text(),
link: `${rootUrl}/x-columnviewpoint/${item.attr('href').match(/\/([\d-]+\.html)/)[1]}`,
link: new URL(item.attr('href'), currentUrl).href,
};
})
.reduce((prev, cur) => (prev.length && prev[prev.length - 1].link === cur.link ? prev : [...prev, cur]), [])