diff --git a/lib/v2/gcores/category.js b/lib/v2/gcores/category.js index a289b33f0..eb63e6d8a 100644 --- a/lib/v2/gcores/category.js +++ b/lib/v2/gcores/category.js @@ -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}`; diff --git a/lib/v2/gcores/tag.js b/lib/v2/gcores/tag.js index 8722ce162..a307b31c2 100644 --- a/lib/v2/gcores/tag.js +++ b/lib/v2/gcores/tag.js @@ -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}`;