diff --git a/lib/v2/tencent/news/author.js b/lib/v2/tencent/news/author.js index 1b025a8ded..290fbf6a0c 100644 --- a/lib/v2/tencent/news/author.js +++ b/lib/v2/tencent/news/author.js @@ -24,34 +24,42 @@ module.exports = async (ctx) => { const author = item.source; const abstract = item.abstract; - return ctx.cache.tryGet(itemUrl, async () => { - const response = await got(itemUrl); - const $ = cheerio.load(response.data); - const data = JSON.parse( - $('script:contains("window.DATA")') - .text() - .match(/window\.DATA = ({.+});/)[1] - ); - const $data = cheerio.load(data.originContent.text, null, false); + return item.articletype === '4' + ? { + title, + description: abstract, + link: itemUrl, + author, + pubDate, + } + : ctx.cache.tryGet(itemUrl, async () => { + const response = await got(itemUrl); + const $ = cheerio.load(response.data); + const data = JSON.parse( + $('script:contains("window.DATA")') + .text() + .match(/window\.DATA = ({.+});/)[1] + ); + const $data = cheerio.load(data.originContent.text, null, false); - $data('*') - .contents() - .filter((_, elem) => elem.type === 'comment') - .replaceWith((_, elem) => - art(path.join(__dirname, '../templates/news/image.art'), { - attribute: elem.data.trim(), - originAttribute: data.originAttribute, - }) - ); + $data('*') + .contents() + .filter((_, elem) => elem.type === 'comment') + .replaceWith((_, elem) => + art(path.join(__dirname, '../templates/news/image.art'), { + attribute: elem.data.trim(), + originAttribute: data.originAttribute, + }) + ); - return { - title, - description: $data.html() || abstract, - link: itemUrl, - author, - pubDate, - }; - }); + return { + title, + description: $data.html() || abstract, + link: itemUrl, + author, + pubDate, + }; + }); }) );