Skip to content

Commit

Permalink
fix(route): 日本経済新聞News (#15170)
Browse files Browse the repository at this point in the history
* fix nikkei/news

* fix import
  • Loading branch information
ladeng07 authored Apr 9, 2024
1 parent e8ab6be commit 4bd6ab2
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions lib/routes/nikkei/news.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,14 @@ 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'],
target: '/:category',
},
],
name: 'News',
maintainers: ['Arracc'],
maintainers: ['Arracc', 'ladeng07'],
handler,
description: `| 総合 | オピニオン | 経済 | 政治 | 金融 | マーケット | ビジネス | マネーのまなび | テック | 国際 | スポーツ | 社会・調査 | 地域 | 文化 | ライフスタイル |
| ---- | ---------- | ------- | -------- | --------- | ---------- | -------- | -------------- | ---------- | ------------- | -------- | ---------- | ----- | ------- | -------------- |
Expand All @@ -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,
Expand Down

0 comments on commit 4bd6ab2

Please sign in to comment.