Files
RSSHub/lib/routes/universities/cucyjs/cucyjs.js
T
Sukka d82847f541 style/chore(eslint): enforce new rules (#8040)
* style: prefer object shorthand syntax
* refactor: prefer Array#map over Array#forEach
* style: prefer arrow callback
* chore(eslint): update rules
* style: auto fix by eslint
2021-08-17 22:23:23 +08:00

24 lines
786 B
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const link = 'http://yz.cuc.edu.cn/listWYFHY/list_0_1.htm';
const response = await got.get(link);
const $ = cheerio.load(response.data, 'utf-8');
const list = $('.notice_main_content2 td').slice(0, 10);
ctx.state.data = {
title: '中国传媒大学',
link,
description: '中国传媒大学研招网通知公告',
item:
list &&
list
.map((index, item) => {
item = $(item);
return { title: item.find('td a').text(), description: item.find('td a').text(), link: item.find('td a').attr('href') };
})
.get(),
};
};