mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 19:59:54 +08:00
feat(route): add kimlaw (#11786)
This commit is contained in:
@@ -114,6 +114,12 @@ pageClass: routes
|
||||
|
||||
<RouteEn author="nczitzk" example="/researchgate/publications/Somsak-Panha" path="/researchgate/publications/:username" :paramsDesc="['Username, can be found in URL']" puppeteer="1" anticrawler="1"/>
|
||||
|
||||
## The Korea Institute of Marine Law
|
||||
|
||||
### Thesis
|
||||
|
||||
<RouteEn author="TonyRL" example="/kimlaw/thesis" path="/kimlaw/thesis" radar="1"/>
|
||||
|
||||
## X-MOL
|
||||
|
||||
### News
|
||||
|
||||
@@ -314,6 +314,12 @@ path="/ctfhub/upcoming/:limit?"
|
||||
|
||||
</Route>
|
||||
|
||||
## 韓國海事法學會
|
||||
|
||||
### 学术论文
|
||||
|
||||
<Route author="TonyRL" example="/kimlaw/thesis" path="/kimlaw/thesis" radar="1"/>
|
||||
|
||||
## 杭州市国家普通话测试网报信息
|
||||
|
||||
### 考试信息
|
||||
|
||||
3
lib/v2/kimlaw/maintainer.js
Normal file
3
lib/v2/kimlaw/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/thesis': ['TonyRL'],
|
||||
};
|
||||
13
lib/v2/kimlaw/radar.js
Normal file
13
lib/v2/kimlaw/radar.js
Normal file
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
3
lib/v2/kimlaw/router.js
Normal file
3
lib/v2/kimlaw/router.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/thesis', require('./thesis'));
|
||||
};
|
||||
44
lib/v2/kimlaw/thesis.js
Normal file
44
lib/v2/kimlaw/thesis.js
Normal file
@@ -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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user