fix(route): 修复机核网路由, 并增加错误抛出 (#9885)

* Fix issue #9877

* Fix issue #9877

* Fix issue #9877
This commit is contained in:
StevenRCE0
2022-06-03 12:25:19 +08:00
committed by GitHub
parent f38716cbac
commit 18d243ad99
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -15,7 +15,7 @@ module.exports = async (ctx) => {
const list = $('.original.am_card.original-normal')
.map(function () {
const item = {
url: $(this).find('a.am_card_content.original_content').attr('href'),
url: $(this).find('.am_card_inner>a').attr('href'),
title: $(this).find('h3.am_card_title').text(),
category: $(this).find('span.original_category>a').text(),
};
@@ -23,6 +23,10 @@ module.exports = async (ctx) => {
})
.get();
if (list.length > 0 && list.every((item) => item.url === undefined)) {
throw new Error('Article URL not found! Please submit an issue on GitHub.');
}
const out = await Promise.all(
list.map((item) => {
const articleUrl = `https://www.gcores.com${item.url}`;
+5 -1
View File
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
const list = $('.original.am_card.original-normal')
.map(function () {
const item = {
url: $(this).find('a.am_card_content.original_content').attr('href'),
url: $(this).find('.am_card_inner>a').attr('href'),
title: $(this).find('h3.am_card_title').text(),
category: $(this).find('span.original_category>a').text(),
};
@@ -24,6 +24,10 @@ module.exports = async (ctx) => {
})
.get();
if (list.length > 0 && list.every((item) => item.url === undefined)) {
throw new Error('Article URL not found! Please submit an issue on GitHub.');
}
const out = await Promise.all(
list.map((item) => {
const articleUrl = `https://www.gcores.com${item.url}`;