Files
RSSHub/lib/v2/ccf/tfbd/index.js
tudou027 65eaa2a6d9 feat(route): 增加大数据专家委员会和中国人工智能学会新闻 (#11510)
* 增加大数据专家委员会和中国人工智能学会新闻

* 修复问题

* fix: add docs for `caai`

fix: maintainer does not with match with router

* fix: add docs for `ccf/tfbd`

fix: use raw output for `art-template`

fix: standardise use of `got`
not using `got()` in one place and `got.get()` in another place

* refactor: migrate to v2

---------
2023-02-28 00:21:26 +08:00

23 lines
621 B
JavaScript

const utils = require('./utils');
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const base = utils.urlBase(ctx.params.caty, ctx.params.id);
const res = await got(base);
const info = utils.fetchAllArticles(res.data);
const $ = cheerio.load(res.data);
const details = await Promise.all(info.map((e) => utils.detailPage(e, ctx.cache)));
ctx.state.json = {
info,
};
ctx.state.data = {
title: '大数据专家委员会 - ' + $('.position a:last-child').text(),
link: base,
item: details,
};
};