From 4bd6ab2ed320ef946a0afb74aa75815cf26180d6 Mon Sep 17 00:00:00 2001 From: LMark <40017222+ladeng07@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:54:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E6=97=A5=E6=9C=AC=E7=B5=8C?= =?UTF-8?q?=E6=B8=88=E6=96=B0=E8=81=9ENews=20(#15170)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix nikkei/news * fix import --- lib/routes/nikkei/news.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/routes/nikkei/news.ts b/lib/routes/nikkei/news.ts index 6d3fb1c2e7dfbf..757dd8d999922a 100644 --- a/lib/routes/nikkei/news.ts +++ b/lib/routes/nikkei/news.ts @@ -14,14 +14,6 @@ export const route: Route = { categories: ['traditional-media'], example: '/nikkei/news', parameters: { category: 'Category, see table below', article_type: 'Only includes free articles, set `free` to enable, disabled by default' }, - features: { - requireConfig: false, - requirePuppeteer: false, - antiCrawler: false, - supportBT: false, - supportPodcast: false, - supportScihub: false, - }, radar: [ { source: ['www.nikkei.com/:category/archive', 'www.nikkei.com/:category'], @@ -29,7 +21,7 @@ export const route: Route = { }, ], name: 'News', - maintainers: ['Arracc'], + maintainers: ['Arracc', 'ladeng07'], handler, description: `| 総合 | オピニオン | 経済 | 政治 | 金融 | マーケット | ビジネス | マネーのまなび | テック | 国際 | スポーツ | 社会・調査 | 地域 | 文化 | ライフスタイル | | ---- | ---------- | ------- | -------- | --------- | ---------- | -------- | -------------- | ---------- | ------------- | -------- | ---------- | ----- | ------- | -------------- | @@ -47,18 +39,18 @@ async function handler(ctx) { const $ = load(data); let categoryName = ''; - const listSelector = $('div#CONTENTS_MAIN').children('div.m-miM09').not('.PRa'); - const paidSelector = 'span.m-iconMember'; + const listSelector = $('[class^="container_"] [class^="default_"]:has(article)'); + const paidSelector = 'img[class^="icon_"]'; let list = listSelector.toArray().map((item) => { item = $(item); item.find('p a').remove(); return { - title: item.find('.m-miM09_titleL').text(), - link: `${baseUrl}${item.find('.m-miM09_title a').attr('href')}`, - image: item.find('.m-miM09_thumb img').removeAttr('style').removeAttr('width').removeAttr('height').parent().html(), + title: item.find('[class^="titleLink_"]').text(), + link: `${baseUrl}${item.find('[class^="title_"] a').attr('href')}`, + image: item.find('[class^="image_"] img').removeAttr('style').removeAttr('width').removeAttr('height').parent().html(), category: item - .find('.m-miM09_keyword a') + .find('[class^="topicItem_"] a') .toArray() .map((item) => $(item).text()), paywall: !!item.find(paidSelector).length,