fix(route): 修复机核网路由, 并增加错误抛出 (#9885)
* Fix issue #9877 * Fix issue #9877 * Fix issue #9877
This commit is contained in:
@@ -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}`;
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user