diff --git a/lib/routes/thepaper/utils.ts b/lib/routes/thepaper/utils.ts index 4c9d6835f..b9c8fe23a 100644 --- a/lib/routes/thepaper/utils.ts +++ b/lib/routes/thepaper/utils.ts @@ -1,6 +1,6 @@ import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import got from '@/utils/got'; import { art } from '@/utils/render'; import path from 'node:path'; @@ -24,7 +24,7 @@ export default { // external link return defaultRssItem(item); } - const itemUrl = `https://m.thepaper.cn/detail/${item.contId}`; + const itemUrl = `https://m.thepaper.cn/${item.cornerLabelDesc && item.cornerLabelDesc === '短剧' ? 'series' : 'detail'}/${item.contId}`; return cache.tryGet(`${itemUrl}${useOldMode ? ':old' : ''}`, async () => { const res = await got(itemUrl); const data = JSON.parse(load(res.data)('#__NEXT_DATA__').html()); @@ -55,12 +55,17 @@ export default { } } + let pubDate = parseDate(item.pubTimeLong || contentDetail.publishTime); + if (Number.isNaN(pubDate)) { + pubDate = parseRelativeDate(contentDetail.pubTime); + } + const rss_item = { title: contentDetail.name || contentDetail.shareName, link: itemUrl, description, category: [...(contentDetail.tagList?.map((t) => t.tag) ?? []), contentDetail?.nodeInfo?.name ?? []], - pubDate: parseDate(item.pubTimeLong || contentDetail.pubTime || contentDetail.publishTime), + pubDate, author: contentDetail.author || '', media: { content: {