diff --git a/docs/traditional-media.md b/docs/traditional-media.md
index 458ceeaad..52a47dd88 100644
--- a/docs/traditional-media.md
+++ b/docs/traditional-media.md
@@ -29,7 +29,7 @@ pageClass: routes
### 话题
-采用了`puppeteer`规避`Project Shield`,无全文抓取,建议自建。
+采用了 `puppeteer` 规避 `Project Shield`,无全文抓取,建议自建。
## BBC
@@ -186,7 +186,7 @@ pageClass: routes
-细则:
+细则:
- `:range` 时间范围参数
(可为 `latest` 或 `四位数字的年份`)
@@ -227,9 +227,9 @@ Solidot 提供的 feed:
可选分类如下
-| WIRELESS | BROADBAND | VIDEO | GENERAL | IT | INDUSTRY RESOURCES |
-| -------- | --------- | --------- | ------- | -- | ------------------ |
-| mobile | internet | boardcast | general | it | industry-resources |
+| WIRELESS | BROADBAND | VIDEO | GENERAL | IT | INDUSTRY RESOURCES |
+| -------- | --------- | --------- | ------- | --- | ------------------ |
+| mobile | internet | boardcast | general | it | industry-resources |
::: tip 提示
@@ -822,9 +822,9 @@ category 对应的关键词有
- 主频道:
- | Business | Markets | World | UK | Tech | Money | Breakingviews | Sport | Life |
- | -------- | ------- | ----- | -- | ---------- | --------------- | ------------- | ------ | --------- |
- | business | markets | world | uk | technology | personalFinance | breakingviews | sports | lifestyle |
+ | Business | Markets | World | UK | Tech | Money | Breakingviews | Sport | Life |
+ | -------- | ------- | ----- | --- | ---------- | --------------- | ------------- | ------ | --------- |
+ | business | markets | world | uk | technology | personalFinance | breakingviews | sports | lifestyle |
@@ -866,9 +866,10 @@ category 对应的关键词有
-### 每日简报
+### 新闻简报
-
+
+网站地址:
### 畅销书排行榜
diff --git a/lib/router.js b/lib/router.js
index 1cfb47b56..54aea8886 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -337,7 +337,7 @@ router.get('/yande.re/post/popular_recent', require('./routes/yande.re/post_popu
router.get('/yande.re/post/popular_recent/:period', require('./routes/yande.re/post_popular_recent'));
// 纽约时报
-router.get('/nytimes/morning_post', require('./routes/nytimes/morning_post'));
+router.get('/nytimes/daily_briefing_chinese', require('./routes/nytimes/daily_briefing_chinese'));
router.get('/nytimes/book/:category?', require('./routes/nytimes/book.js'));
router.get('/nytimes/:lang?', require('./routes/nytimes/index'));
diff --git a/lib/routes/nytimes/daily_briefing_chinese.js b/lib/routes/nytimes/daily_briefing_chinese.js
new file mode 100644
index 000000000..663877dd0
--- /dev/null
+++ b/lib/routes/nytimes/daily_briefing_chinese.js
@@ -0,0 +1,51 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const url = 'https://www.nytimes.com/zh-hans/series/daily-briefing-chinese';
+ const response = await got({
+ method: 'get',
+ url,
+ });
+ const data = response.data;
+ const $ = cheerio.load(data);
+ const post = $('.css-13mho3u .css-ye6x8s')
+ .map((index, elem) => {
+ const $item = $(elem);
+ const $link = $item.find('a');
+ const $title = $item.find('h2');
+
+ return {
+ title: $title.text(),
+ link: 'https://www.nytimes.com' + $link.attr('href'),
+ };
+ })
+ .get();
+
+ const items = await Promise.all(
+ post.map(
+ async (item) =>
+ await ctx.cache.tryGet(item.link, async () => {
+ const response = await got.get(item.link);
+ const $ = cheerio.load(response.data);
+ $('.css-pncxxs.etfikam0').remove();
+ $('.css-1xdhyk6.erfvjey0').each((_, item) => {
+ item = $(item);
+ const link = item.find('img').attr('src');
+ item.replaceWith(`
`);
+ });
+ item.description = $('.meteredContent.css-1r7ky0e').html();
+ const date = $('.css-x7rtpa.e16638kd0').attr('datetime');
+ item.pubDate = parseDate(date);
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: '纽约时报中文网|新闻简报',
+ link: url,
+ item: items,
+ };
+};
diff --git a/lib/routes/nytimes/morning_post.js b/lib/routes/nytimes/morning_post.js
deleted file mode 100644
index f0ff3ea20..000000000
--- a/lib/routes/nytimes/morning_post.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const utils = require('./utils');
-
-module.exports = async (ctx) => {
- const url = 'https://www.nytimes.com/svc/collections/v1/publish/https://www.nytimes.com/zh-hans/series/daily-briefing-chinese/rss.xml';
- const response = await got({
- method: 'get',
- url,
- });
- const data = response.data;
- const $ = cheerio.load(data);
- const post = $('item')
- .map((index, elem) => {
- const title = $(elem).find('title').text();
- const link = $(elem).find('link').next().text();
- return {
- link: link,
- title: title,
- };
- })
- .get();
-
- const browser = await require('@/utils/puppeteer')();
-
- const items = await Promise.all(
- post.map(async (item) => {
- // use puppeter cause all the image is lazy-load
- const result = utils.ProcessFeed(await utils.PuppeterGetter(ctx, browser, item.link), true);
-
- item.pubDate = result.pubDate;
-
- // Match 感谢|謝.*?cn.letters@nytimes.com。
- const ending = /感(谢|謝);.*?cn\.letters@nytimes\.com。/g;
-
- const matching = '
';
- const formatted = '
' + matching;
-
- item.description = result.description.replace(ending, '').split(matching).join(formatted);
-
- return Promise.resolve(item);
- })
- );
-
- browser.close();
-
- ctx.state.data = {
- title: '纽约时报中文网|每日简报',
- link: url,
- item: items,
- };
-};
diff --git a/lib/routes/nytimes/utils.js b/lib/routes/nytimes/utils.js
index 72452c1d0..58a70e593 100644
--- a/lib/routes/nytimes/utils.js
+++ b/lib/routes/nytimes/utils.js
@@ -1,4 +1,5 @@
const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
const ProcessImage = ($, e) => {
const photo = $(e).find('figure').find('picture').find('img');
@@ -87,7 +88,7 @@ const ProcessFeed = (data, hasEnVersion = false) => {
const time = $('time').attr('datetime');
if (time) {
- result.pubDate = new Date(time).toUTCString();
+ result.pubDate = parseDate(time);
}
result.description = content.html();