Files
RSSHub/lib/v2/upc/yjs.js
Tony 8699b4c9d3 fix(route): fix namespace mess from #4283 (#12353)
* refactor: fix scut namespace

* refactor: fix gzhu namespace

* refactor: fix scnu namespace

* refactor: fix hust namespace

* refactor: fix ccnu namespace

* refactor: fix sustech namespace

* refactor: fix szu namespace

remove `/szuyjs` since it's a duplicate of `/szu/yz/:type?`

* refactor: fix tongji namespace

* refactor: fix ocu namespace

* refactor: fix upc namespace

* refactor: fix ucas namespace

* refactor: fix cas namespace

* refactor: fix cau namespace

* refactor: remove `/cucyjs` since `/cuc/yz` existed well before that

* refactor: fix bit namespace

* refactor: fix **undocumented** scau namespace

* fix: typo

* fix: code scan
2023-04-20 09:32:13 +08:00

29 lines
913 B
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const baseUrl = 'http://zs.gs.upc.edu.cn';
const link = `${baseUrl}/sszs/list.htm`;
const response = await got(link);
const $ = cheerio.load(response.data);
const list = $('.list tr');
ctx.state.data = {
title: '中国石油大学研究生院',
link,
description: '中国石油大学研究生院通知公告',
item:
list &&
list.toArray().map((item) => {
item = $(item);
const a = item.find('a');
return {
title: a.attr('title'),
link: `${baseUrl}${a.attr('href')}`,
pubDate: parseDate(item.find('div[style]').text()),
};
}),
};
};