Files
RSSHub/lib/v2/seu/radio/academic.js
T
PyangWU 32889f5f58 feat(route): add 东南大学研究生院公告 (#12958)
* feat(route): add 东南大学研究生院公告

* feat(route): add 东南大学研究生院公告

* add radar

* format scripts

* Update lib/v2/seu/radar.js

* Update lib/v2/seu/yjs.js

* Update lib/v2/seu/yjs.js

* fix redundancy

* refactor: migrate to v2

* fix: typo

---------
2023-08-11 20:59:13 +08:00

44 lines
1.3 KiB
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const host = 'https://radio.seu.edu.cn';
const link = new URL('_s29/15986/list.psp', host).href;
const response = await got(link);
const $ = cheerio.load(response.data);
const list = $('.list_item')
.toArray()
.map((e) => {
e = $(e);
const a = e.find('.Article_Title a');
return {
title: a.attr('title'),
link: new URL(a.attr('href'), host).href,
pubDate: parseDate(e.find('.Article_PublishDate').text()),
};
});
const out = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const response = await got(item.link);
const $ = cheerio.load(response.data);
item.author = $('.arti_publisher').text().replace('发布者:', '');
item.description = $('.wp_articlecontent').html();
return item;
})
)
);
ctx.state.data = {
title: '东南大学信息科学与工程学院 -- 学术活动',
link,
item: out,
};
};