Files
RSSHub/lib/v2/thepaper/featured.js
T
Felix Hsu b053af1050 refactor: refactor thepaper utils for optimize rss reading (#10859)
* 1. fix timezone shift 2. add podcast for voice article 3.use list icon for list feed 4. category support

* extract logo using cheerio

* fix the fallback logo image on list feed

* fix the deepscan insufficient null checking

* add support for album type article
2022-09-22 22:47:09 +08:00

19 lines
640 B
JavaScript

const utils = require('./utils');
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got('https://m.thepaper.cn');
const data = JSON.parse(cheerio.load(response.data)('#__NEXT_DATA__').html());
const list = data.props.pageProps.data.list;
const items = await Promise.all(list.map((item) => utils.ProcessItem(item, ctx)));
ctx.state.data = {
title: '澎湃新闻 - 首页头条',
link: 'https://m.thepaper.cn',
item: items,
itunes_author: '澎湃新闻',
image: utils.ExtractLogo(response),
};
};