diff --git a/lib/v2/thepaper/utils.js b/lib/v2/thepaper/utils.js index b71b16bf5..bf472fd0c 100644 --- a/lib/v2/thepaper/utils.js +++ b/lib/v2/thepaper/utils.js @@ -18,12 +18,13 @@ const defaultRssItem = (item) => ({ module.exports = { ProcessItem: (item, ctx) => { + const useOldMode = ctx.query.old === 'yes'; if (item.link) { // external link return defaultRssItem(item); } const itemUrl = `https://m.thepaper.cn/detail/${item.contId}`; - return ctx.cache.tryGet(itemUrl, async () => { + return ctx.cache.tryGet(`${itemUrl}${useOldMode ? ':old' : ''}`, async () => { const res = await got(itemUrl); const data = JSON.parse(cheerio.load(res.data)('#__NEXT_DATA__').html()); const detailData = data.props.pageProps.detailData; @@ -34,18 +35,23 @@ module.exports = { let description = contentDetail.content || contentDetail.summary || contentDetail.desc || ''; if (contentDetail.videos) { - description = - art(path.join(__dirname, 'templates/video_detail.art'), { - // see https://nanmu.me/zh-cn/posts/2020/strange-html-video-tag-behavior-in-wechat/ - // for video tag details - videos: contentDetail.videos, - }) + description; + description = description + contentDetail.summary; } - if (contentDetail.images) { - description = - art(path.join(__dirname, 'templates/image_detail.art'), { - images: contentDetail.images, - }) + description; + if (useOldMode) { + if (contentDetail.videos) { + description = + art(path.join(__dirname, 'templates/video_detail.art'), { + // see https://nanmu.me/zh-cn/posts/2020/strange-html-video-tag-behavior-in-wechat/ + // for video tag details + videos: contentDetail.videos, + }) + description; + } + if (contentDetail.images) { + description = + art(path.join(__dirname, 'templates/image_detail.art'), { + images: contentDetail.images, + }) + description; + } } const rss_item = { diff --git a/website/docs/routes/traditional-media.md b/website/docs/routes/traditional-media.md index 85996ff8a..73e8eb424 100644 --- a/website/docs/routes/traditional-media.md +++ b/website/docs/routes/traditional-media.md @@ -2019,6 +2019,8 @@ category 对应的关键词有 ## 澎湃新闻 {#peng-pai-xin-wen} +以下所有路由可使用参数`old`以采取旧全文获取方法. 该方法会另外获取网页中的图片与视频资源. 在原始url追加`?old=yes`以启用. + ### 首页头条 {#peng-pai-xin-wen-shou-ye-tou-tiao}