Files
RSSHub/lib/v2/thepaper/list.js
Felix Hsu fe50f9cb18 fix(route): thepaper changes its site to nextjs based backend, so change the feeder (#10850)
* fix(route) thepaper now use nextjs as backend

* Id to Name for channel and list

* summary ok

* determine the detail by null check instead of type check

* list_url for better reading

* add failback of thumbnail

* fix video article

* add list for thepaper

* add list for thepaper

* del the dup line

* small fix and optimize

* add maintainer
2022-09-21 22:53:50 +08:00

20 lines
641 B
JavaScript

const utils = require('./utils');
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const { id } = ctx.params;
const list_url = `https://m.thepaper.cn/list/${id}`;
const response = await got(list_url);
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: `澎湃新闻栏目 - ${utils.ListIdToName(id, data)}`,
link: list_url,
item: items,
};
};