diff --git a/docs/en/study.md b/docs/en/study.md
index 2e5367d93d9296..65f2236bb768c2 100644
--- a/docs/en/study.md
+++ b/docs/en/study.md
@@ -114,6 +114,12 @@ pageClass: routes
+## The Korea Institute of Marine Law
+
+### Thesis
+
+
+
## X-MOL
### News
diff --git a/docs/government.md b/docs/government.md
index aa7d48a88fcc10..1abf8cfba83c00 100644
--- a/docs/government.md
+++ b/docs/government.md
@@ -44,6 +44,22 @@ pageClass: routes
+## 北京社科网
+
+### 通用
+
+
+
+::: tip 提示
+
+路径处填写对应页面 URL 中 `https://www.bjsk.org.cn/` 和 `.html` 之间的字段。下面是一个例子。
+
+若订阅 [社科资讯 > 社科要闻](https://www.bjsk.org.cn/newslist-1394-1474-0.html) 则将对应页面 URL 中 `https://www.bjsk.org.cn/` 和 `.html` 之间的字段 `newslist-1394-1474-0` 作为路径填入。此时路由为 [`/bjsk/newslist-1394-1474-0`](https://rsshub.app/bjsk/newslist-1394-1474-0)
+
+:::
+
+
+
## 北京市保障房中心有限公司
### 北京市共有产权住房租赁服务平台
@@ -98,6 +114,18 @@ pageClass: routes
+## 北京无线电协会
+
+### 最新资讯
+
+
+
+| 协会活动 | 公告通知 | 会议情况 | 简报 | 政策法规 | 学习园地 | 业余无线电服务中心 | 经验交流 | 新技术推介 | 活动通知 | 爱好者园地 | 结果查询 | 资料下载 | 会员之家 | 会员简介 | 会员风采 | 活动报道 |
+| ---- | ---- | ---- | --- | ---- | ---- | --------- | ---- | ----- | ---- | ----- | ---- | ---- | ---- | ---- | ---- | ---- |
+| 86 | 99 | 102 | 103 | 106 | 107 | 108 | 111 | 112 | 114 | 115 | 116 | 118 | 119 | 120 | 121 | 122 |
+
+
+
## 重庆市人民政府
### 两江新区信息公开网
@@ -1038,6 +1066,12 @@ pageClass: routes
+## 中国科学技术协会
+
+### 通用
+
+
+
## 中国农工民主党
### 新闻中心
diff --git a/docs/picture.md b/docs/picture.md
index 44d02324351572..49b289ed53cd67 100644
--- a/docs/picture.md
+++ b/docs/picture.md
@@ -155,15 +155,15 @@ pageClass: routes
### 收藏
-
+
### 标签
-
+
### 搜索
-
+
## Elite Babes
diff --git a/docs/study.md b/docs/study.md
index 027f00249476de..bb6ed7389674f6 100644
--- a/docs/study.md
+++ b/docs/study.md
@@ -314,6 +314,12 @@ path="/ctfhub/upcoming/:limit?"
+## 韓國海事法學會
+
+### 学术论文
+
+
+
## 杭州市国家普通话测试网报信息
### 考试信息
diff --git a/lib/v2/bjsk/index.js b/lib/v2/bjsk/index.js
new file mode 100644
index 00000000000000..4eb2ecfc42a0ba
--- /dev/null
+++ b/lib/v2/bjsk/index.js
@@ -0,0 +1,52 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+const baseUrl = 'https://www.bjsk.org.cn';
+
+module.exports = async (ctx) => {
+ const { path = 'newslist-1486-0-0' } = ctx.params;
+ const link = `${baseUrl}/${path}.html`;
+ const { data: response } = await got(link, {
+ https: {
+ rejectUnauthorized: false,
+ },
+ });
+ const $ = cheerio.load(response);
+
+ const list = $('.article-list a')
+ .toArray()
+ .map((item) => {
+ item = $(item);
+ return {
+ title: item.attr('title'),
+ link: `${baseUrl}${item.attr('href')}`,
+ pubDate: parseDate(item.find('.time').text(), 'YYYY.MM.DD'),
+ };
+ });
+
+ const items = await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const { data: response } = await got(item.link, {
+ https: {
+ rejectUnauthorized: false,
+ },
+ });
+ const $ = cheerio.load(response);
+ item.description = $('.article-main').html();
+ item.author = $('.info')
+ .text()
+ .match(/作者:(.*)\s+来源/)[1];
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: $('head title').text(),
+ link,
+ image: 'https://www.bjsk.org.cn/favicon.ico',
+ item: items,
+ };
+};
diff --git a/lib/v2/bjsk/maintainer.js b/lib/v2/bjsk/maintainer.js
new file mode 100644
index 00000000000000..fc59b3430f04cd
--- /dev/null
+++ b/lib/v2/bjsk/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/:path?': ['TonyRL'],
+};
diff --git a/lib/v2/bjsk/radar.js b/lib/v2/bjsk/radar.js
new file mode 100644
index 00000000000000..e952f13b101659
--- /dev/null
+++ b/lib/v2/bjsk/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'bjsk.org.cn': {
+ _name: '北京社科网',
+ '.': [
+ {
+ title: '通用',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-she-ke-wang',
+ source: ['/*'],
+ target: (_, url) => `/bjsk/${url.split('/')[3].replace('.html', '')}`,
+ },
+ ],
+ },
+};
diff --git a/lib/v2/bjsk/router.js b/lib/v2/bjsk/router.js
new file mode 100644
index 00000000000000..71d391a9c24825
--- /dev/null
+++ b/lib/v2/bjsk/router.js
@@ -0,0 +1,3 @@
+module.exports = (router) => {
+ router.get('/:path?', require('./index'));
+};
diff --git a/lib/v2/bjwxdxh/index.js b/lib/v2/bjwxdxh/index.js
new file mode 100644
index 00000000000000..35d2b533494504
--- /dev/null
+++ b/lib/v2/bjwxdxh/index.js
@@ -0,0 +1,52 @@
+const cheerio = require('cheerio');
+const got = require('@/utils/got');
+const timezone = require('@/utils/timezone');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const baseUrl = 'http://www.bjwxdxh.org.cn';
+ const type = ctx.params.type;
+ const link = type ? `${baseUrl}/news/class/?${type}.html` : `${baseUrl}/news/class/`;
+
+ const response = await got({
+ method: 'get',
+ url: link,
+ });
+
+ const $ = cheerio.load(response.data);
+ const list = $('div#newsquery > ul > li')
+ .map((_, item) => {
+ item = $(item);
+ return {
+ title: item.find('div.title > a').text(),
+ link: new URL(item.find('div.title > a').attr('href'), baseUrl).href,
+ // pubDate: parseDate(item.find('div.time').text(), 'YYYY-MM-DD'),
+ };
+ })
+ .get();
+
+ await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const response = await got({
+ method: 'get',
+ url: item.link,
+ });
+ const content = cheerio.load(response.data);
+ const info = content('div.info')
+ .text()
+ .match(/作者:(.*?)\s+发布于:(.*?\s+.*?)\s/);
+ item.author = info[1];
+ item.pubDate = timezone(parseDate(info[2], 'YYYY-MM-DD HH:mm:ss'), +8);
+ item.description = content('div#con').html().trim().replace(/\n/g, '');
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: $('title').text(),
+ link,
+ item: list,
+ };
+};
diff --git a/lib/v2/bjwxdxh/maintainer.js b/lib/v2/bjwxdxh/maintainer.js
new file mode 100644
index 00000000000000..2e9657170f0c73
--- /dev/null
+++ b/lib/v2/bjwxdxh/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/:type?': ['Misaka13514'],
+};
diff --git a/lib/v2/bjwxdxh/radar.js b/lib/v2/bjwxdxh/radar.js
new file mode 100644
index 00000000000000..7d9fa7cc20e22c
--- /dev/null
+++ b/lib/v2/bjwxdxh/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'bjwxdxh.org.cn': {
+ _name: '北京无线电协会',
+ www: [
+ {
+ title: '最新资讯',
+ docs: 'https://docs.rsshub.app/government.html#bei-jing-wu-xian-dian-xie-hui',
+ source: '/news/class/',
+ target: (params, url) => (url.includes('?') ? `/bjwxdxh/${url.split('?')[1].split('.')[0]}` : '/bjwxdxh'),
+ },
+ ],
+ },
+};
diff --git a/lib/v2/bjwxdxh/router.js b/lib/v2/bjwxdxh/router.js
new file mode 100644
index 00000000000000..7ec1cc98e85268
--- /dev/null
+++ b/lib/v2/bjwxdxh/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/:type?', require('./index'));
+};
diff --git a/lib/v2/cast/index.js b/lib/v2/cast/index.js
new file mode 100644
index 00000000000000..3364eda20b394d
--- /dev/null
+++ b/lib/v2/cast/index.js
@@ -0,0 +1,74 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+const timezone = require('@/utils/timezone');
+const baseUrl = 'https://www.cast.org.cn';
+
+module.exports = async (ctx) => {
+ const { column = 457 } = ctx.params;
+ const { limit = 10 } = ctx.query;
+ const link = `${baseUrl}/col/col${column}/index.html`;
+ const { data: response } = await got.post(`${baseUrl}/module/web/jpage/dataproxy.jsp`, {
+ searchParams: {
+ startrecord: 1,
+ endrecord: limit,
+ perpage: limit,
+ },
+ form: {
+ col: 1,
+ appid: 1,
+ webid: 1,
+ path: '/',
+ columnid: column,
+ sourceContentType: 1,
+ unitid: 335,
+ webname: '中国科学技术协会',
+ permissiontype: 0,
+ },
+ });
+
+ const $ = cheerio.load(response, {
+ xml: {
+ xmlMode: true,
+ },
+ });
+
+ const pageTitle = await ctx.cache.tryGet(link, async () => {
+ const { data: response } = await got(link);
+ const $ = cheerio.load(response);
+ return $('head title').text();
+ });
+
+ const list = $('record')
+ .toArray()
+ .map((item) => {
+ item = cheerio.load($(item).html(), null, false);
+ const a = item('a').first();
+ return {
+ title: a.text(),
+ pubDate: parseDate(item('.list-data').text().trim(), 'DDYYYY/MM'),
+ link: `${baseUrl}${a.attr('href')}`,
+ };
+ });
+
+ const items = await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const { data: response } = await got(item.link);
+ const $ = cheerio.load(response);
+
+ item.description = $('#zoom').html();
+ item.pubDate = timezone(parseDate($('meta[name=PubDate]').attr('content'), 'YYYY-MM-DD HH:mm'), +8);
+
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: pageTitle,
+ link,
+ image: 'https://www.cast.org.cn/favicon.ico',
+ item: items,
+ };
+};
diff --git a/lib/v2/cast/maintainer.js b/lib/v2/cast/maintainer.js
new file mode 100644
index 00000000000000..14959a57e2f88e
--- /dev/null
+++ b/lib/v2/cast/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/:column?': ['TonyRL'],
+};
diff --git a/lib/v2/cast/radar.js b/lib/v2/cast/radar.js
new file mode 100644
index 00000000000000..601998a4406214
--- /dev/null
+++ b/lib/v2/cast/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'cast.org.cn': {
+ _name: '中国科学技术协会',
+ '.': [
+ {
+ title: '通用',
+ docs: 'https://docs.rsshub.app/government.html#zhong-guo-ke-xue-ji-shu-xie-hui',
+ source: ['/col/:column/index.html'],
+ target: (params) => `/cast/${params.column.replace('col', '')}`,
+ },
+ ],
+ },
+};
diff --git a/lib/v2/cast/router.js b/lib/v2/cast/router.js
new file mode 100644
index 00000000000000..3177e33676491d
--- /dev/null
+++ b/lib/v2/cast/router.js
@@ -0,0 +1,3 @@
+module.exports = (router) => {
+ router.get('/:column?', require('./index'));
+};
diff --git a/lib/v2/ehentai/ehapi.js b/lib/v2/ehentai/ehapi.js
index 364b857c3d73ef..123eac668138ab 100644
--- a/lib/v2/ehentai/ehapi.js
+++ b/lib/v2/ehentai/ehapi.js
@@ -192,25 +192,30 @@ async function gatherItemsByPage(cache, url, get_bittorrent = false, embed_thumb
return updateBittorrent_url(cache, items);
}
-async function getFavoritesItems(cache, page, favcat, inline_set, get_bittorrent = false, embed_thumb = false) {
+async function getFavoritesItems(cache, favcat, inline_set, page = undefined, get_bittorrent = false, embed_thumb = false) {
const response = await ehgot(`favorites.php?favcat=${favcat}&inline_set=${inline_set}`);
- if (parseInt(page) === 0) {
+ if (page) {
+ return gatherItemsByPage(cache, `favorites.php?favcat=${favcat}&next=${page}`, get_bittorrent, embed_thumb);
+ } else {
const items = await parsePage(cache, response.data, get_bittorrent, embed_thumb);
return updateBittorrent_url(cache, items);
}
- return gatherItemsByPage(cache, `favorites.php?page=${page}&favcat=${favcat}`, get_bittorrent, embed_thumb);
}
function getSearchItems(cache, params, page = undefined, get_bittorrent = false, embed_thumb = false) {
if (page) {
- return gatherItemsByPage(cache, `?page=${page}&${params}`, get_bittorrent, embed_thumb);
+ return gatherItemsByPage(cache, `?${params}&next=${page}`, get_bittorrent, embed_thumb);
} else {
return gatherItemsByPage(cache, `?${params}`, get_bittorrent, embed_thumb);
}
}
function getTagItems(cache, tag, page, get_bittorrent = false, embed_thumb = false) {
- return gatherItemsByPage(cache, `tag/${tag}/${page}`, get_bittorrent, embed_thumb);
+ if (page) {
+ return gatherItemsByPage(cache, `tag/${tag}?next=${page}`, get_bittorrent, embed_thumb);
+ } else {
+ return gatherItemsByPage(cache, `tag/${tag}`, get_bittorrent, embed_thumb);
+ }
}
module.exports = { getFavoritesItems, getSearchItems, getTagItems, has_cookie, from_ex };
diff --git a/lib/v2/ehentai/favorites.js b/lib/v2/ehentai/favorites.js
index d049ebc54f77bc..d0e1d01ebf4dcb 100644
--- a/lib/v2/ehentai/favorites.js
+++ b/lib/v2/ehentai/favorites.js
@@ -5,12 +5,12 @@ module.exports = async (ctx) => {
throw 'Ehentai favorites RSS is disabled due to the lack of relevant config';
}
const favcat = ctx.params.favcat ? parseInt(ctx.params.favcat) : 0;
- const page = ctx.params.page ? parseInt(ctx.params.page) : 0;
+ const page = ctx.params.page;
const routeParams = new URLSearchParams(ctx.params.routeParams);
const bittorrent = routeParams.get('bittorrent') || false;
const embed_thumb = routeParams.get('embed_thumb') || false;
const inline_set = ctx.params.order === 'posted' ? 'fs_p' : 'fs_f';
- const items = await EhAPI.getFavoritesItems(ctx.cache, page, favcat, inline_set, bittorrent, embed_thumb);
+ const items = await EhAPI.getFavoritesItems(ctx.cache, favcat, inline_set, page, bittorrent, embed_thumb);
if (EhAPI.from_ex) {
ctx.state.data = {
diff --git a/lib/v2/ehentai/search.js b/lib/v2/ehentai/search.js
index f63e10ad90f5c1..8ca4279ae245df 100644
--- a/lib/v2/ehentai/search.js
+++ b/lib/v2/ehentai/search.js
@@ -9,8 +9,8 @@ module.exports = async (ctx) => {
let items;
if (page) {
// 如果定义了page,就要覆盖params
- params = params.replace(/&*page=[^&]$/, '').replace(/page=[^&]&/, '');
- items = await EhAPI.getSearchItems(ctx.cache, params, parseInt(page), bittorrent, embed_thumb);
+ params = params.replace(/&*next=[^&]$/, '').replace(/next=[^&]&/, '');
+ items = await EhAPI.getSearchItems(ctx.cache, params, page, bittorrent, embed_thumb);
} else {
items = await EhAPI.getSearchItems(ctx.cache, params, undefined, bittorrent, embed_thumb);
}
diff --git a/lib/v2/ehentai/tag.js b/lib/v2/ehentai/tag.js
index 6c65241cf9a366..3759df0d2921fb 100644
--- a/lib/v2/ehentai/tag.js
+++ b/lib/v2/ehentai/tag.js
@@ -1,7 +1,7 @@
const EhAPI = require('./ehapi');
module.exports = async (ctx) => {
- const page = ctx.params.page ? parseInt(ctx.params.page) : 0;
+ const page = ctx.params.page;
const tag = ctx.params.tag;
const routeParams = new URLSearchParams(ctx.params.routeParams);
const bittorrent = routeParams.get('bittorrent') || false;
diff --git a/lib/v2/kimlaw/maintainer.js b/lib/v2/kimlaw/maintainer.js
new file mode 100644
index 00000000000000..9a5de98735c5e3
--- /dev/null
+++ b/lib/v2/kimlaw/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/thesis': ['TonyRL'],
+};
diff --git a/lib/v2/kimlaw/radar.js b/lib/v2/kimlaw/radar.js
new file mode 100644
index 00000000000000..9594081872c371
--- /dev/null
+++ b/lib/v2/kimlaw/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'kimlaw.or.kr': {
+ _name: '韓國海事法學會',
+ '.': [
+ {
+ title: '学术论文',
+ docs: 'https://docs.rsshub.app/study.html#han-guo-hai-shi-fa-xue-hui',
+ source: ['/67', '/'],
+ target: '/kimlaw/thesis',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/kimlaw/router.js b/lib/v2/kimlaw/router.js
new file mode 100644
index 00000000000000..f50b19dd8e62b3
--- /dev/null
+++ b/lib/v2/kimlaw/router.js
@@ -0,0 +1,3 @@
+module.exports = (router) => {
+ router.get('/thesis', require('./thesis'));
+};
diff --git a/lib/v2/kimlaw/thesis.js b/lib/v2/kimlaw/thesis.js
new file mode 100644
index 00000000000000..d4facb381eb22d
--- /dev/null
+++ b/lib/v2/kimlaw/thesis.js
@@ -0,0 +1,44 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+const timezone = require('@/utils/timezone');
+
+const baseUrl = 'https://www.kimlaw.or.kr';
+
+module.exports = async (ctx) => {
+ const link = `${baseUrl}/67`;
+ const { data: response } = await got(link);
+
+ const $ = cheerio.load(response);
+ const list = $('.li_body')
+ .toArray()
+ .map((item) => {
+ item = $(item);
+ const a = item.find('a.list_text_title');
+ return {
+ title: a.text(),
+ link: `${baseUrl}${a.attr('href')}`,
+ author: item.find('.name').text(),
+ pubDate: timezone(parseDate(item.find('.time').attr('title')), 9),
+ };
+ });
+
+ const items = await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const { data: response } = await got(item.link);
+ const $ = cheerio.load(response);
+
+ item.description = $('.board_txt_area').html();
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: `${$('.widget_menu_title').text()} - ${$('head title').text()}`,
+ link,
+ image: 'https://cdn.imweb.me/upload/S20210819f9dd86d20e7d7/9aec17c4e98a5.ico',
+ item: items,
+ };
+};
diff --git a/lib/v2/pku/ss/admission.js b/lib/v2/pku/ss/admission.js
index 585b8553a63653..b7cd0572ceb143 100644
--- a/lib/v2/pku/ss/admission.js
+++ b/lib/v2/pku/ss/admission.js
@@ -1,48 +1,10 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const { parseDate } = require('@/utils/parse-date');
+const { baseUrl, getSingleRecord, getArticle } = require('./common');
-const link = 'http://www.ss.pku.edu.cn';
-const host = 'http://www.ss.pku.edu.cn/index.php/admission/admnotice';
-
-const getSingleRecord = async () => {
- const res = await got(host);
-
- const $ = cheerio.load(res.data);
- const list = $('#info-list-ul').find('li');
-
- return (
- list &&
- list
- .map((index, item) => {
- item = $(item);
- const date = item.find('.time').text();
- return {
- title: item.find('a').attr('title'),
- pubDate: parseDate(date),
- link: link + item.find('a').attr('href'),
- };
- })
- .get()
- );
-};
+const host = `${baseUrl}/admission/admnotice/`;
module.exports = async (ctx) => {
- const items = await getSingleRecord();
- const out = await Promise.all(
- items.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const response = await got(item.link);
- const $ = cheerio.load(response.data);
- return {
- title: item.title,
- link: item.link,
- description: $('.article-content').html(),
- pubDate: item.pubDate,
- };
- })
- )
- );
+ const items = await getSingleRecord(host);
+ const out = await Promise.all(items.map((item) => getArticle(item, ctx.cache.tryGet)));
ctx.state.data = {
title: '北大软微-招生通知',
diff --git a/lib/v2/pku/ss/common.js b/lib/v2/pku/ss/common.js
new file mode 100644
index 00000000000000..d518c79654264b
--- /dev/null
+++ b/lib/v2/pku/ss/common.js
@@ -0,0 +1,37 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+const baseUrl = 'https://www.ss.pku.edu.cn';
+
+const getSingleRecord = async (url) => {
+ const res = await got(url);
+
+ const $ = cheerio.load(res.data);
+ const list = $('#info-list-ul').find('li');
+
+ return list.toArray().map((item) => {
+ item = $(item);
+ const date = item.find('.time').text();
+ return {
+ title: item.find('a').attr('title'),
+ pubDate: parseDate(date),
+ link: baseUrl + item.find('a').attr('href'),
+ };
+ });
+};
+
+const getArticle = (item, tryGet) =>
+ tryGet(item.link, async () => {
+ const response = await got(item.link);
+ const $ = cheerio.load(response.data);
+
+ item.description = $('.article-content').html();
+ return item;
+ });
+
+module.exports = {
+ baseUrl,
+ getSingleRecord,
+ getArticle,
+};
diff --git a/lib/v2/pku/ss/notice.js b/lib/v2/pku/ss/notice.js
index 778a1810ff8d28..71dfeb058f1e60 100644
--- a/lib/v2/pku/ss/notice.js
+++ b/lib/v2/pku/ss/notice.js
@@ -1,48 +1,10 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const { parseDate } = require('@/utils/parse-date');
+const { baseUrl, getSingleRecord, getArticle } = require('./common');
-const link = 'http://www.ss.pku.edu.cn';
-const host = 'http://www.ss.pku.edu.cn/index.php/newscenter/notice';
-
-const getSingleRecord = async () => {
- const res = await got(host);
-
- const $ = cheerio.load(res.data);
- const list = $('#info-list-ul').find('li');
-
- return (
- list &&
- list
- .map((index, item) => {
- item = $(item);
- const date = item.find('.time').text();
- return {
- title: item.find('a').attr('title'),
- pubDate: parseDate(date),
- link: link + item.find('a').attr('href'),
- };
- })
- .get()
- );
-};
+const host = `${baseUrl}/newscenter/notice/`;
module.exports = async (ctx) => {
- const items = await getSingleRecord();
- const out = await Promise.all(
- items.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const response = await got(item.link);
- const $ = cheerio.load(response.data);
- return {
- title: item.title,
- link: item.link,
- description: $('.article-content').html(),
- pubDate: item.pubDate,
- };
- })
- )
- );
+ const items = await getSingleRecord(host);
+ const out = await Promise.all(items.map((item) => getArticle(item, ctx.cache.tryGet)));
ctx.state.data = {
title: '北大软微-通知公告',
diff --git a/lib/v2/pku/ss/pg_admin.js b/lib/v2/pku/ss/pg_admin.js
index 734fc282987597..2c7fdd801fda94 100644
--- a/lib/v2/pku/ss/pg_admin.js
+++ b/lib/v2/pku/ss/pg_admin.js
@@ -1,48 +1,10 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const { parseDate } = require('@/utils/parse-date');
+const { baseUrl, getSingleRecord, getArticle } = require('./common');
-const link = 'http://www.ss.pku.edu.cn';
-const host = 'http://www.ss.pku.edu.cn/index.php/admission/admbrochure/admission01';
-
-const getSingleRecord = async () => {
- const res = await got(host);
-
- const $ = cheerio.load(res.data);
- const list = $('#info-list-ul').find('li');
-
- return (
- list &&
- list
- .map((index, item) => {
- item = $(item);
- const date = item.find('.time').text();
- return {
- title: item.find('a').attr('title'),
- pubDate: parseDate(date),
- link: link + item.find('a').attr('href'),
- };
- })
- .get()
- );
-};
+const host = `${baseUrl}/admission/admbrochure/`;
module.exports = async (ctx) => {
- const items = await getSingleRecord();
- const out = await Promise.all(
- items.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const response = await got(item.link);
- const $ = cheerio.load(response.data);
- return {
- title: item.title,
- link: item.link,
- description: $('.article-content').html(),
- pubDate: item.pubDate,
- };
- })
- )
- );
+ const items = await getSingleRecord(host);
+ const out = await Promise.all(items.map((item) => getArticle(item, ctx.cache.tryGet)));
ctx.state.data = {
title: '北大软微-硕士统考招生',