diff --git a/lib/routes/nytimes/morning_post.js b/lib/routes/nytimes/morning_post.js index a9f477c7a82c88..f0ff3ea20535be 100644 --- a/lib/routes/nytimes/morning_post.js +++ b/lib/routes/nytimes/morning_post.js @@ -10,35 +10,36 @@ module.exports = async (ctx) => { }); 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 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); + 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; + item.pubDate = result.pubDate; - // Match 感谢|謝.*?cn.letters@nytimes.com。 - const ending = /感(谢|謝);.*?cn\.letters@nytimes\.com。/g; + // Match 感谢|謝.*?cn.letters@nytimes.com。 + const ending = /感(谢|謝);.*?cn\.letters@nytimes\.com。/g; - const matching = '