rsshub 1.0.0-master.c9bb12f → 1.0.0-master.c9e423b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/router.js CHANGED
@@ -563,11 +563,12 @@ router.get('/lit/tw/:name?', lazyloadRouteHandler('./routes/universities/lit/tw'
563
563
  router.get('/thu/career', lazyloadRouteHandler('./routes/universities/thu/career'));
564
564
  router.get('/thu/:type', lazyloadRouteHandler('./routes/universities/thu/index'));
565
565
 
566
- // 北京大学
567
- router.get('/pku/eecs/:type?', lazyloadRouteHandler('./routes/universities/pku/eecs'));
568
- router.get('/pku/rccp/mzyt', lazyloadRouteHandler('./routes/universities/pku/rccp/mzyt'));
569
- router.get('/pku/cls/lecture', lazyloadRouteHandler('./routes/universities/pku/cls/lecture'));
570
- router.get('/pku/bbs/hot', lazyloadRouteHandler('./routes/universities/pku/bbs/hot'));
566
+ // 北京大学 migrated to v2
567
+ // router.get('/pku/eecs/:type?', lazyloadRouteHandler('./routes/universities/pku/eecs'));
568
+ // router.get('/pku/rccp/mzyt', lazyloadRouteHandler('./routes/universities/pku/rccp/mzyt'));
569
+ // router.get('/pku/cls/lecture', lazyloadRouteHandler('./routes/universities/pku/cls/lecture'));
570
+ // router.get('/pku/bbs/hot', lazyloadRouteHandler('./routes/universities/pku/bbs/hot'));
571
+ // router.get('/pku/scc/recruit/:type?', lazyloadRouteHandler('./routes/universities/pku/scc/recruit'));
571
572
 
572
573
  // 上海海事大学
573
574
  router.get('/shmtu/www/:type', lazyloadRouteHandler('./routes/universities/shmtu/www'));
@@ -1855,10 +1856,10 @@ router.get('/simonsfoundation/recommend', lazyloadRouteHandler('./routes/simonsf
1855
1856
  // 王者荣耀
1856
1857
  router.get('/tencent/pvp/newsindex/:type', lazyloadRouteHandler('./routes/tencent/pvp/newsindex'));
1857
1858
 
1858
- // 《明日方舟》游戏
1859
- router.get('/arknights/news', lazyloadRouteHandler('./routes/arknights/news'));
1860
- // アークナイツ(明日方舟日服)
1861
- router.get('/arknights/japan', lazyloadRouteHandler('./routes/arknights/japan'));
1859
+ // 《明日方舟》游戏 (migrated to v2)
1860
+ // router.get('/arknights/news', lazyloadRouteHandler('./routes/arknights/news'));
1861
+ // アークナイツ(明日方舟日服) (migrated to v2)
1862
+ // router.get('/arknights/japan', lazyloadRouteHandler('./routes/arknights/japan'));
1862
1863
  // 塞壬唱片
1863
1864
  router.get('/siren/news', lazyloadRouteHandler('./routes/siren/index'));
1864
1865
 
@@ -2640,8 +2641,8 @@ router.get('/scutyjs', lazyloadRouteHandler('./routes/universities/scut/scutyjs'
2640
2641
  // 华南农业大学研究生院通知公告
2641
2642
  router.get('/scauyjs', lazyloadRouteHandler('./routes/universities/scauyjs/scauyjs'));
2642
2643
 
2643
- // 北京大学研究生招生网通知公告
2644
- router.get('/pkuyjs', lazyloadRouteHandler('./routes/universities/pku/pkuyjs'));
2644
+ // 北京大学研究生招生网通知公告 migrated to v2
2645
+ // router.get('/pkuyjs', lazyloadRouteHandler('./routes/universities/pku/pkuyjs'));
2645
2646
 
2646
2647
  // 北京理工大学研究生通知公告
2647
2648
  router.get('/bityjs', lazyloadRouteHandler('./routes/universities/bit/bityjs'));
@@ -0,0 +1,55 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ module.exports = async (ctx) => {
6
+ const { platform = 'Android', group = 'ALL' } = ctx.params;
7
+
8
+ let {
9
+ data: { announceList },
10
+ } = await got({
11
+ method: 'get',
12
+ url: `https://ak-conf.hypergryph.com/config/prod/announce_meta/${platform}/announcement.meta.json`,
13
+ });
14
+
15
+ if (group !== 'ALL') {
16
+ announceList = announceList.filter((item) => item.group === group);
17
+ }
18
+
19
+ announceList = await Promise.all(
20
+ announceList.map((item) =>
21
+ ctx.cache.tryGet(item.webUrl, async () => {
22
+ const { data } = await got({
23
+ method: 'get',
24
+ url: item.webUrl,
25
+ });
26
+
27
+ const $ = cheerio.load(data);
28
+ let description =
29
+ // 一般来讲是有字的
30
+ $('.content').html() ??
31
+ // 有些情况只有一张图
32
+ $('.banner-image-container.cover').html() ??
33
+ // 有些情况啥都没有(暂时没有遇到)
34
+ 'No Description';
35
+
36
+ // 游戏内部跳转链接
37
+ description = description.replace(/href="uniwebview:\/\/.+?"/, 'href="#"');
38
+
39
+ return {
40
+ title: item.title,
41
+ description,
42
+ // 不知道是哪一年的,所以不管了
43
+ pubDate: parseDate(`${item.month}-${item.day}`, 'M-D'),
44
+ link: item.webUrl,
45
+ };
46
+ })
47
+ )
48
+ );
49
+
50
+ ctx.state.data = {
51
+ title: `《明日方舟》${group === 'SYSTEM' ? '系统' : group === 'ACTIVITY' ? '活动' : '全部'}公告`,
52
+ link: 'https://ak.hypergryph.com/',
53
+ item: announceList,
54
+ };
55
+ };
@@ -1,4 +1,5 @@
1
1
  const got = require('@/utils/got');
2
+ const { parseDate } = require('@/utils/parse-date');
2
3
 
3
4
  module.exports = async (ctx) => {
4
5
  const response = await got({
@@ -10,7 +11,7 @@ module.exports = async (ctx) => {
10
11
  const newsList = items.map((item) => ({
11
12
  title: item.title,
12
13
  description: item.content[0].value,
13
- pubDate: item.publishedAt,
14
+ pubDate: parseDate(item.publishedAt),
14
15
  link: `https://www.arknights.jp/news/${item.id}`,
15
16
  }));
16
17
 
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ '/announce/:platform?/:group?': ['swwind'],
3
+ '/japan': ['ofyark'],
4
+ '/news': ['Astrian'],
5
+ };
@@ -1,5 +1,6 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
3
4
 
4
5
  module.exports = async (ctx) => {
5
6
  const response = await got({
@@ -16,18 +17,18 @@ module.exports = async (ctx) => {
16
17
  newslist
17
18
  .slice(0, 9) // limit article count to a single page
18
19
  .map(async (index, item) => {
19
- const sth = $(item);
20
- const link = `https://ak.hypergryph.com${sth.attr('href')}`;
20
+ item = $(item);
21
+ const link = `https://ak.hypergryph.com${item.attr('href')}`;
21
22
  const description = await ctx.cache.tryGet(link, async () => {
22
- const result = await got.get(link);
23
+ const result = await got(link);
23
24
  const $ = cheerio.load(result.data);
24
25
  return $('.article-content').html();
25
26
  });
26
27
  return {
27
- title: `[${sth.find('.articleItemCate').first().text()}] ${sth.find('.articleItemTitle').first().text()}`,
28
+ title: `[${item.find('.articleItemCate').first().text()}] ${item.find('.articleItemTitle').first().text()}`,
28
29
  description,
29
30
  link,
30
- pubDate: new Date(sth.find('.articleItemDate').first().text()),
31
+ pubDate: parseDate(item.find('.articleItemDate').first().text()),
31
32
  };
32
33
  })
33
34
  .get()
@@ -0,0 +1,40 @@
1
+ module.exports = {
2
+ 'arknights.jp': {
3
+ _name: '明日方舟',
4
+ ak: [
5
+ {
6
+ title: 'アークナイツ(日服新闻)',
7
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
8
+ source: ['/news?lang=ja&limit=9&page=1', '/'],
9
+ target: '/arknights/japan',
10
+ },
11
+ ],
12
+ },
13
+ 'hypergryph.com': {
14
+ _name: '明日方舟',
15
+ ak: [
16
+ {
17
+ title: '游戏公告与新闻',
18
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
19
+ source: ['/news.html', '/'],
20
+ target: '/arknights/news',
21
+ },
22
+ ],
23
+ 'ak-conf': [
24
+ {
25
+ title: '游戏内公告',
26
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
27
+ source: ['/*'],
28
+ target: '/arknights/news',
29
+ },
30
+ ],
31
+ 'monster-siren': [
32
+ {
33
+ title: '塞壬唱片',
34
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
35
+ source: ['/info', '/'],
36
+ target: '/siren/news',
37
+ },
38
+ ],
39
+ },
40
+ };
@@ -0,0 +1,8 @@
1
+ module.exports = function (router) {
2
+ // 《明日方舟》游戏内公告
3
+ router.get('/announce/:platform?/:group?', require('./announce'));
4
+ // アークナイツ(明日方舟日服)
5
+ router.get('/japan', require('./japan'));
6
+ // 《明日方舟》游戏公告与新闻
7
+ router.get('/news', require('./news'));
8
+ };
@@ -0,0 +1,9 @@
1
+ const fetchItems = require('./utils');
2
+
3
+ module.exports = async (ctx) => {
4
+ const id = ctx.params.id;
5
+
6
+ const currentUrl = `onlyfans/user/${id}`;
7
+
8
+ ctx.state.data = await fetchItems(ctx, currentUrl);
9
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ '/artist/:id': ['nczitzk'],
3
+ '/posts': ['nczitzk'],
4
+ };
@@ -0,0 +1,7 @@
1
+ const fetchItems = require('./utils');
2
+
3
+ module.exports = async (ctx) => {
4
+ const currentUrl = 'posts';
5
+
6
+ ctx.state.data = await fetchItems(ctx, currentUrl);
7
+ };
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ 'coomer.party': {
3
+ _name: 'Coomer',
4
+ '.': [
5
+ {
6
+ title: 'Artist',
7
+ docs: 'https://docs.rsshub.app/multimedia.html#coomer-artist',
8
+ source: ['/onlyfans/user/:id', '/'],
9
+ target: '/coomer/artist/:id',
10
+ },
11
+ {
12
+ title: 'Recent Posts',
13
+ docs: 'https://docs.rsshub.app/multimedia.html#coomer-recent-posts',
14
+ source: ['/posts', '/'],
15
+ target: '/coomer/posts',
16
+ },
17
+ ],
18
+ },
19
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = function (router) {
2
+ router.get('/artist/:id', require('./artist'));
3
+ router.get('/posts', require('./posts'));
4
+ };
@@ -0,0 +1,53 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ module.exports = async (ctx, currentUrl) => {
6
+ const rootUrl = 'https://coomer.party';
7
+ currentUrl = `${rootUrl}/${currentUrl}`;
8
+
9
+ const response = await got({
10
+ method: 'get',
11
+ url: currentUrl,
12
+ });
13
+
14
+ const $ = cheerio.load(response.data);
15
+
16
+ let items = $('.post-card__link .fancy-link')
17
+ .toArray()
18
+ .map((item) => {
19
+ item = $(item);
20
+
21
+ return {
22
+ link: `${rootUrl}${item.attr('href')}`,
23
+ };
24
+ });
25
+
26
+ items = await Promise.all(
27
+ items.map((item) =>
28
+ ctx.cache.tryGet(item.link, async () => {
29
+ const detailResponse = await got({
30
+ method: 'get',
31
+ url: item.link,
32
+ });
33
+
34
+ const content = cheerio.load(detailResponse.data);
35
+
36
+ content('.ad-container').remove();
37
+
38
+ item.author = content('.post__user-name').text();
39
+ item.title = content('.post__title span').first().text();
40
+ item.pubDate = parseDate(content('.timestamp').attr('datetime'));
41
+ item.description = content('.post__body').html();
42
+
43
+ return item;
44
+ })
45
+ )
46
+ );
47
+
48
+ return {
49
+ title: $('title').text(),
50
+ link: currentUrl,
51
+ item: items,
52
+ };
53
+ };
@@ -1,14 +1,8 @@
1
1
  const config = require('@/config').value;
2
2
  const cheerio = require('cheerio');
3
3
  const got = require('@/utils/got');
4
- const resolveUrl = require('url').resolve;
5
-
6
- function parseDate(text) {
7
- const match = /[0-9 :-]+/.exec(text);
8
- if (match) {
9
- return new Date(match[0]).toUTCString();
10
- }
11
- }
4
+ const { parseDate } = require('@/utils/parse-date');
5
+ const timezone = require('@/utils/timezone');
12
6
 
13
7
  module.exports = async (ctx) => {
14
8
  const cookie = config.pkubbs.cookie;
@@ -21,7 +15,7 @@ module.exports = async (ctx) => {
21
15
  const listItems = $('#list-content .list-item')
22
16
  .map(function () {
23
17
  return {
24
- url: resolveUrl(r.url, $(this).find('> a.link').attr('href')),
18
+ url: new URL($(this).find('> a.link').attr('href'), r.url).href,
25
19
  title: $(this).find('.title').text(),
26
20
  };
27
21
  })
@@ -35,12 +29,13 @@ module.exports = async (ctx) => {
35
29
  try {
36
30
  const r = await got(url, { headers });
37
31
  const $ = cheerio.load(r.body);
32
+ const date = $('.post-card:first-child .sl-triangle-container .down-list span').text() || $('.post-card:first-child .sl-triangle-container .title span').text();
38
33
  return {
39
34
  title,
40
35
  description: $('.post-card:first-child .content').html(),
41
36
  link: url,
42
37
  guid: url,
43
- pubDate: parseDate($('.post-card:first-child .sl-triangle-container .title span').text()),
38
+ pubDate: timezone(parseDate(date, '发表于YYYY-MM-DD HH:mm:ss'), +8),
44
39
  };
45
40
  } catch (error) {
46
41
  return {
@@ -1,14 +1,12 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
3
4
 
4
- const homeUrl = 'http://www.bio.pku.edu.cn/homes/Index/news_jz/7/7.html';
5
- const baseUrl = 'http://www.bio.pku.edu.cn';
5
+ const homeUrl = 'http://bio.pku.edu.cn/homes/Index/news_jz/7/7.html';
6
+ const baseUrl = 'http://bio.pku.edu.cn';
6
7
 
7
8
  module.exports = async (ctx) => {
8
- const response = await got({
9
- method: 'get',
10
- url: homeUrl,
11
- });
9
+ const response = await got(homeUrl);
12
10
 
13
11
  const $ = cheerio.load(response.data);
14
12
  ctx.state.data = {
@@ -19,7 +17,7 @@ module.exports = async (ctx) => {
19
17
  .map((index, item) => ({
20
18
  title: $(item).find('p').text().trim(),
21
19
  description: '日期: ' + $(item).find('span'), // ${item.find('.chair_txt div').find('span').second().text()}
22
-
20
+ pubDate: parseDate($(item).find('.date').text()),
23
21
  link: baseUrl + $('a.clearfix').attr('href'),
24
22
  }))
25
23
  .get(),
@@ -0,0 +1,64 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const { eecsMap } = require('./utils');
6
+
7
+ module.exports = async (ctx) => {
8
+ const host = 'https://eecs.pku.edu.cn';
9
+
10
+ let type = ctx.params && parseInt(ctx.params.type);
11
+ if (type === undefined) {
12
+ type = 0;
13
+ }
14
+
15
+ const response = await got(host + '/xygk1/ggtz/' + eecsMap.get(type));
16
+
17
+ const $ = cheerio.load(response.data);
18
+ let items = $('.hvr-shutter-out-vertical')
19
+ .toArray()
20
+ .map((item) => {
21
+ item = $(item);
22
+ return {
23
+ title: item.attr('title'),
24
+ link: new URL(item.attr('href'), host).href,
25
+ pubDate: parseDate(item.find('em').text()),
26
+ };
27
+ });
28
+
29
+ items = await Promise.all(
30
+ items.map((item) =>
31
+ ctx.cache.tryGet(item.link, async () => {
32
+ const detail = await got(item.link);
33
+ const content = cheerio.load(detail.data);
34
+
35
+ content('input').remove();
36
+ content('h1').remove();
37
+ content('.con_xq').remove();
38
+
39
+ content('form[name=_newscontent_fromname] img').each((_, i) => {
40
+ i = $(i);
41
+ if (i.attr('src').startsWith('/')) {
42
+ i.attr('src', new URL(i.attr('src'), host).href);
43
+ }
44
+ });
45
+ content('form[name=_newscontent_fromname] ul li a').each((_, a) => {
46
+ a = $(a);
47
+ if (a.attr('href').startsWith('/')) {
48
+ a.attr('href', new URL(a.attr('href'), host).href);
49
+ }
50
+ });
51
+
52
+ item.description = content('form[name=_newscontent_fromname]').html();
53
+ return item;
54
+ })
55
+ )
56
+ );
57
+
58
+ ctx.state.data = {
59
+ title: $('title').text(),
60
+ link: host + '/xygk1/ggtz/' + eecsMap.get(type),
61
+ description: '北大信科 公告通知',
62
+ item: items,
63
+ };
64
+ };
@@ -1,3 +1,9 @@
1
1
  module.exports = {
2
+ '/admission/sszs': ['pkuyjs'],
3
+ '/bbs/hot': ['wooddance'],
4
+ '/cls/lecture': ['TPOB'],
5
+ '/eecs/:type?': ['Ir1d'],
2
6
  '/hr/:category?': ['nczitzk'],
7
+ '/rccp/mzyt': ['vhxubo'],
8
+ '/scc/recruit/:type?': ['DylanXie123'],
3
9
  };
@@ -0,0 +1,29 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ module.exports = async (ctx) => {
6
+ const link = 'https://admission.pku.edu.cn/zsxx/sszs/index.htm';
7
+ const response = await got(link);
8
+ const $ = cheerio.load(response.data);
9
+ const list = $('.zsxx_cont_list li');
10
+
11
+ ctx.state.data = {
12
+ title: `${$('.twostage_title_C').text()} - ${$('title').text()}`,
13
+ link,
14
+ description: '北京大学研究生院通知公告',
15
+ item:
16
+ list &&
17
+ list
18
+ .map((index, item) => {
19
+ item = $(item);
20
+ return {
21
+ title: item.find('li a').text(),
22
+ description: item.find('li a').text(),
23
+ link: item.find('li a').attr('href'),
24
+ pubDate: parseDate(item.find('.zsxxCont_list_time').text()),
25
+ };
26
+ })
27
+ .get(),
28
+ };
29
+ };
@@ -1,6 +1,73 @@
1
1
  module.exports = {
2
2
  'pku.edu.cn': {
3
3
  _name: '北京大学',
4
+ admission: [
5
+ {
6
+ title: '硕士招生',
7
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
8
+ source: ['/zsxx/sszs/index.htm', '/'],
9
+ target: '/pku/admission/sszs',
10
+ },
11
+ ],
12
+ bbs: [
13
+ {
14
+ title: '北大未名 BBS 全站十大',
15
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
16
+ source: ['/v2/hot-topic.php', '/'],
17
+ target: '/pku/bbs/hot',
18
+ },
19
+ ],
20
+ bio: [
21
+ {
22
+ title: '生命科学学院近期讲座',
23
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
24
+ source: ['/homes/Index/news_jz/7/7.html', '/'],
25
+ target: '/pku/cls/lecture',
26
+ },
27
+ ],
28
+ eecs: [
29
+ {
30
+ title: '信科公告通知',
31
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
32
+ source: ['/xygk1/ggtz/:type', '/xygk1/ggtz.htm', '/'],
33
+ target: (params) => {
34
+ let type = params.type;
35
+ switch (type) {
36
+ case 'qb.htm':
37
+ type = 0;
38
+ break;
39
+ case 'xytz.htm':
40
+ type = 1;
41
+ break;
42
+ case 'rstz.htm':
43
+ type = 2;
44
+ break;
45
+ case 'jwtz.htm':
46
+ type = 6;
47
+ break;
48
+ case 'xgtz.htm':
49
+ type = 8;
50
+ break;
51
+ case 'kytz.htm':
52
+ type = 7;
53
+ break;
54
+ case 'cwtz.htm':
55
+ type = 5;
56
+ break;
57
+ case 'ghtz.htm':
58
+ type = 3;
59
+ break;
60
+ case 'yytz.htm':
61
+ type = 4;
62
+ break;
63
+ default:
64
+ type = 0;
65
+ break;
66
+ }
67
+ return `/pku/eecs/${type}`;
68
+ },
69
+ },
70
+ ],
4
71
  hr: [
5
72
  {
6
73
  title: '人事处',
@@ -9,5 +76,47 @@ module.exports = {
9
76
  target: '/pku/hr/:category?',
10
77
  },
11
78
  ],
79
+ 'www.rccp': [
80
+ {
81
+ title: '每周一推 - 中国政治学研究中心',
82
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue-ren-shi-chu',
83
+ source: ['/'],
84
+ target: '/pku/rccp/mzyt',
85
+ },
86
+ ],
87
+ scc: [
88
+ {
89
+ title: '学生就业指导服务中心',
90
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue-ren-shi-chu',
91
+ source: ['/*path'],
92
+ target: (params) => {
93
+ let type;
94
+ switch (params.path) {
95
+ case 'home!newsHome.action?category=12':
96
+ type = 'xwrd';
97
+ break;
98
+ case 'home!newsHome.action?category=13':
99
+ type = 'tzgg';
100
+ break;
101
+ case 'home!recruit.action?category=1&jobType=110001':
102
+ type = 'zpxx';
103
+ break;
104
+ case 'home!recruitList.action?category=1&jobType=110002':
105
+ type = 'gfjgxx';
106
+ break;
107
+ case 'home!recruitList.action?category=2':
108
+ type = 'sxxx';
109
+ break;
110
+ case 'home!newsHome.action?category=11':
111
+ type = 'cyxx';
112
+ break;
113
+ default:
114
+ type = 'zpxx';
115
+ break;
116
+ }
117
+ return `/pku/scc/recruit/${type}`;
118
+ },
119
+ },
120
+ ],
12
121
  },
13
122
  };
@@ -0,0 +1,23 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const baseUrl = 'https://www.rccp.pku.edu.cn/mzyt/';
5
+
6
+ module.exports = async (ctx) => {
7
+ const response = await got(baseUrl);
8
+
9
+ const $ = cheerio.load(response.data);
10
+ ctx.state.data = {
11
+ title: '每周一推 - 北京大学中国政治学研究中心',
12
+ link: baseUrl,
13
+ description: $('meta[name="description"]').attr('content'),
14
+ item: $('li.list')
15
+ .map((index, item) => ({
16
+ title: $(item).find('a').text().trim(),
17
+ description: '',
18
+ pubDate: parseDate($(item).find('span').first().text(), '[YYYY-MM-DD]'),
19
+ link: baseUrl + $(item).find('a').attr('href'),
20
+ }))
21
+ .get(),
22
+ };
23
+ };
@@ -1,3 +1,9 @@
1
1
  module.exports = function (router) {
2
+ router.get('/admission/sszs', require('./pkuyjs'));
3
+ router.get('/bbs/hot', require('./bbs/hot'));
4
+ router.get('/cls/lecture', require('./cls/lecture'));
5
+ router.get('/eecs/:type?', require('./eecs'));
2
6
  router.get('/hr/:category?', require('./hr'));
7
+ router.get('/rccp/mzyt', require('./rccp/mzyt'));
8
+ router.get('/scc/recruit/:type?', require('./scc/recruit'));
3
9
  };
@@ -0,0 +1,58 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const arr = {
6
+ xwrd: 'home!newsHome.action?category=12',
7
+ tzgg: 'home!newsHome.action?category=13',
8
+ zpxx: 'home!recruit.action?category=1&jobType=110001',
9
+ gfjgxx: 'home!recruitList.action?category=1&jobType=110002',
10
+ sxxx: 'home!recruitList.action?category=2',
11
+ cyxx: 'home!newsHome.action?category=11',
12
+ };
13
+ const baseUrl = 'https://scc.pku.edu.cn/';
14
+
15
+ module.exports = async (ctx) => {
16
+ const type = ctx.params.type ?? 'zpxx';
17
+ const rootUrl = baseUrl + arr[type];
18
+
19
+ const list_response = await got(rootUrl);
20
+ const $ = cheerio.load(list_response.data);
21
+
22
+ const feed_title = $('h2.category').text();
23
+
24
+ const list = $('div#articleList-body div.item.clearfix')
25
+ .map((_, item) => {
26
+ item = $(item);
27
+ const a = item.find('a');
28
+ const date = parseDate(item.find('div.item-date').text());
29
+ return {
30
+ title: a.text(),
31
+ link: new URL(a.attr('href'), baseUrl),
32
+ pubDate: date,
33
+ };
34
+ })
35
+ .get();
36
+
37
+ const sorted = list.sort((a, b) => b.pubDate.getTime() - a.pubDate.getTime()).slice(0, 10);
38
+
39
+ ctx.state.data = {
40
+ title: `北京大学学生就业指导服务中心 - ${feed_title}`,
41
+ link: rootUrl,
42
+ item: await Promise.all(
43
+ sorted.map((item) =>
44
+ ctx.cache.tryGet(item.link, async () => {
45
+ const detail_page = await got(item.link);
46
+ const detail = cheerio.load(detail_page.data);
47
+ const script = detail('script', 'div#content-div').html();
48
+ if (script !== null) {
49
+ const content_route = script.match(/\$\("#content-div"\).load\("(\S+)"\)/)[1];
50
+ const content = await got(new URL(content_route, baseUrl).href);
51
+ item.description = content.data;
52
+ }
53
+ return item;
54
+ })
55
+ )
56
+ ),
57
+ };
58
+ };
@@ -0,0 +1,15 @@
1
+ const eecsMap = new Map([
2
+ [0, 'qb.htm'],
3
+ [1, 'xytz.htm'],
4
+ [2, 'rstz.htm'],
5
+ [6, 'jwtz.htm'],
6
+ [8, 'xgtz.htm'],
7
+ [7, 'kytz.htm'],
8
+ [5, 'cwtz.htm'],
9
+ [3, 'ghtz.htm'],
10
+ [4, 'yytz.htm'],
11
+ ]);
12
+
13
+ module.exports = {
14
+ eecsMap,
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsshub",
3
- "version": "1.0.0-master.c9bb12f",
3
+ "version": "1.0.0-master.c9e423b",
4
4
  "description": "Make RSS Great Again!",
5
5
  "main": "lib/pkg.js",
6
6
  "files": [
@@ -112,7 +112,7 @@
112
112
  "lru-cache": "7.8.1",
113
113
  "lz-string": "1.4.4",
114
114
  "mailparser": "3.4.0",
115
- "markdown-it": "12.3.2",
115
+ "markdown-it": "13.0.0",
116
116
  "module-alias": "2.2.2",
117
117
  "parse-torrent": "9.1.5",
118
118
  "pidusage": "3.0.0",
@@ -1,41 +0,0 @@
1
- const got = require('@/utils/got');
2
- const cheerio = require('cheerio');
3
-
4
- module.exports = async (ctx) => {
5
- const host = 'http://eecs.pku.edu.cn/';
6
-
7
- let type = ctx.params && ctx.params.type;
8
- if (type === undefined) {
9
- type = '0';
10
- }
11
-
12
- const response = await got({
13
- method: 'get',
14
- url: host + 'Survey/Notice/?Mtitle=' + type,
15
- headers: {
16
- Referer: host,
17
- },
18
- });
19
-
20
- const $ = cheerio.load(response.data);
21
- const text = $('.hvr-shutter-out-vertical').slice(0, 10);
22
-
23
- ctx.state.data = {
24
- title: '北大信科通知',
25
- link: host + 'Survey/Notice/?Mtitle=' + type,
26
- description: '北大信科 公告通知',
27
- item:
28
- text &&
29
- text
30
- .map((index, item) => {
31
- item = $(item);
32
- return {
33
- title: item.find('p').text(),
34
- link: host + 'Survey/Notice/' + item.attr('href'),
35
- description: item.find('p').text(),
36
- pubDate: item.find('em').text(),
37
- };
38
- })
39
- .get(),
40
- };
41
- };
@@ -1,23 +0,0 @@
1
- const got = require('@/utils/got');
2
- const cheerio = require('cheerio');
3
-
4
- module.exports = async (ctx) => {
5
- const link = 'https://admission.pku.edu.cn/zsxx/sszs/index.htm';
6
- const response = await got.get(link);
7
- const $ = cheerio.load(response.data);
8
- const list = $('.zsxx_cont_list li').slice(0, 10);
9
-
10
- ctx.state.data = {
11
- title: '北京大学研究生院',
12
- link,
13
- description: '北京大学研究生院通知公告',
14
- item:
15
- list &&
16
- list
17
- .map((index, item) => {
18
- item = $(item);
19
- return { title: item.find('li a').text(), description: item.find('li a').text(), link: item.find('li a').attr('href') };
20
- })
21
- .get(),
22
- };
23
- };
@@ -1,33 +0,0 @@
1
- const got = require('@/utils/got');
2
- const cheerio = require('cheerio');
3
-
4
- const baseUrl = 'http://www.rccp.pku.edu.cn/mzyt/';
5
-
6
- module.exports = async (ctx) => {
7
- const response = await got({
8
- method: 'get',
9
- url: baseUrl,
10
- });
11
-
12
- const $ = cheerio.load(response.data);
13
- ctx.state.data = {
14
- title: `每周一推 - 北京大学中国政治学研究中心`,
15
- link: baseUrl,
16
- description: `北京大学中国政治学研究中心,北大中国政治学研究中心,北大政治学研究中心,中国政治学研究中心,政治学研究中心,政治学,北大政治学,北京大学,俞可平
17
- 北京大学中国政治学研究中心官方网站:www.rccp.pku.edu.cn 。
18
- 北京大学中国政治学研究中心微信公众平台:“北大政治学”(微信号:PKURCCP)`,
19
- item: $('li.list')
20
- .map((index, item) => ({
21
- title: $(item).find('a').text().trim(),
22
- description: '',
23
- pubDate: $(item)
24
- .find('span')
25
- .first()
26
- .text()
27
- .match(/\d{4}-\d{2}-\d{2}/g)[0],
28
-
29
- link: baseUrl + $(item).find('a').attr('href'),
30
- }))
31
- .get(),
32
- };
33
- };