feat: BOOKSOURCE.STORE (#4129)

This commit is contained in:
归谜
2020-03-01 13:27:41 +08:00
committed by GitHub
parent 2f74c13487
commit 7659ba514b
9 changed files with 89 additions and 58 deletions

View File

@@ -25,6 +25,12 @@ pageClass: routes
</Route> </Route>
## BOOKSOURCE.STORE
### 书源仓库更新
<Route author="vhxubo" example="/booksource" path="/booksource"/>
## checkee.info ## checkee.info
### 美国签证 check 动态 ### 美国签证 check 动态
@@ -483,6 +489,17 @@ type 为 all 时category 参数不支持 cost 和 free
<Route author="kt286" example="/mail/imap/rss@rsshub.app" path="/mail/imap/:email" :paramsDesc="['邮箱账号']" /> <Route author="kt286" example="/mail/imap/rss@rsshub.app" path="/mail/imap/:email" :paramsDesc="['邮箱账号']" />
## 源仓库
### 源仓库更新
<Route author="vhxubo" example="/ku" path="/ku/:name?" :paramsDesc="['默认为 `yuedu`']">
| 阅读 | 异次元 | 海阔 |
| ---- | ----- | ---- |
| yuedu | yiciyuan | haikuo |
</Route>
## 远程.work ## 远程.work
### 远程.work 招聘信息 ### 远程.work 招聘信息

View File

@@ -52,7 +52,7 @@ pageClass: routes
### 每周一推 - 中国政治学研究中心 ### 每周一推 - 中国政治学研究中心
<Route author="AngUOI" example="/pku/rccp/mzyt" path="/universities/pku/rccp/mzyt" /> <Route author="vhxubo" example="/pku/rccp/mzyt" path="/universities/pku/rccp/mzyt" />
### 生命科学学院近期讲座 ### 生命科学学院近期讲座
@@ -546,11 +546,11 @@ category 列表:
### 教务处 ### 教务处
<Route author="AngUOI" example="/lit/jwc" path="/universities/lit/jwc" /> <Route author="vhxubo" example="/lit/jwc" path="/universities/lit/jwc" />
### 新闻中心 ### 新闻中心
<Route author="AngUOI" example="/lit/xwzx" path="/universities/lit/xwzx/:name?" :paramsDesc="['默认为 `all`']"> <Route author="vhxubo" example="/lit/xwzx" path="/universities/lit/xwzx/:name?" :paramsDesc="['默认为 `all`']">
| 全部 | 公告通知 | 新闻快讯 | 学术信息 | 媒体新闻 | | 全部 | 公告通知 | 新闻快讯 | 学术信息 | 媒体新闻 |
| ---- | -------- | -------- | -------- | -------- | | ---- | -------- | -------- | -------- | -------- |
@@ -560,7 +560,7 @@ category 列表:
### 团委 ### 团委
<Route author="AngUOI" example="/lit/tw" path="/universities/lit/tw/:name?" :paramsDesc="['默认为 `all`']"> <Route author="vhxubo" example="/lit/tw" path="/universities/lit/tw/:name?" :paramsDesc="['默认为 `all`']">
| 全部 | 团内通知 | 青年快讯 | | 全部 | 团内通知 | 青年快讯 |
| ---- | -------- | -------- | | ---- | -------- | -------- |

View File

@@ -1887,9 +1887,6 @@ router.get('/cfan/news', require('./routes/cfan/news'));
// 搜狐 - 搜狐号 // 搜狐 - 搜狐号
router.get('/sohu/mp/:id', require('./routes/sohu/mp')); router.get('/sohu/mp/:id', require('./routes/sohu/mp'));
// 厚墨书源索引
router.get('/houmo/:code?', require('./routes/houmo/booksource'));
// 腾讯企鹅号 // 腾讯企鹅号
router.get('/tencent/news/author/:mid', require('./routes/tencent/news/author')); router.get('/tencent/news/author/:mid', require('./routes/tencent/news/author'));
@@ -2307,6 +2304,12 @@ router.get('/wolley/host/:host', require('./routes/wolley/host'));
// 西安交大 // 西安交大
router.get('/xjtu/dean/:subpath+', require('./routes/universities/xjtu/dean')); router.get('/xjtu/dean/:subpath+', require('./routes/universities/xjtu/dean'));
// booksource
router.get('/booksource', require('./routes/booksource/index'));
// ku
router.get('/ku/:name?', require('./routes/ku/index'));
// 我有一片芝麻地 // 我有一片芝麻地
router.get('/blogs/hedwig/:type', require('./routes/blogs/hedwig')); router.get('/blogs/hedwig/:type', require('./routes/blogs/hedwig'));

View File

@@ -0,0 +1,22 @@
const got = require('@/utils/got');
const api = 'http://api.booksource.store/repo/list?sort=update_time&page=1&size=10';
module.exports = async (ctx) => {
const response = await got.get(api);
const data = response.data;
ctx.state.data = {
title: `BOOKSOURCE.STORE`,
link: 'http://booksource.store/',
description: `BOOKSOURCE.STORE RSS`,
item: data.map((item) => ({
title: `${item.name} - v${item.version}`,
guid: item.url,
author: item.owner,
pubDate: item.update_time,
description: `<p>网址: ${item.url}</p>
<p>作者: ${item.owner}</p>
<p>更新时间: ${item.update_time}</p>
<p>${item.rank || item.account ? '其它:' : ''} ${item.rank === true ? '排行榜' : ''} ${item.account === true ? '网站账号登录' : ''}</p>`,
})),
};
};

View File

@@ -1,51 +0,0 @@
const got = require('@/utils/got');
const url = 'http://qingmo.zohar.space/git/repository.json';
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: url,
});
const code = ctx.params.code;
const list = response.data.list;
if (!code) {
ctx.state.data = {
title: `BookSource`,
link: url,
description: `厚墨书源索引`,
item: list.map((item) => {
const author = item.name.match(/(.*?)-/g)[0].replace('-', '');
return {
title: item.name + ` v` + item.version,
description: `<p class="author">作者: ${author}</p><p class="code">暗码: ${item.code}</p><p>tg群: @deepinkapp</p><p>论坛地址: https://andyt.cn/</p>`,
link: item.url.replace('real site => ', ''),
author: author,
};
}),
};
} else {
const items = [];
list.map((item) => {
const author = item.name.match(/(.*?)-/g)[0].replace('-', '');
if (item.code === code) {
items.push({
title: item.name + ` v` + item.version,
description: `<p class="author">作者: ${author}<p>tg群: @deepinkapp</p><p>论坛地址: https://andyt.cn/</p>`,
link: item.url.replace('real site => ', ''),
author: author,
});
}
return 0;
});
ctx.state.data = {
title: `${code} - BookSource`,
link: url,
description: `暗码: ${code} - 厚墨书源索引`,
item: items,
};
}
};

31
lib/routes/ku/index.js Normal file
View File

@@ -0,0 +1,31 @@
const got = require('@/utils/got');
const nameProps = {
yuedu: '阅读',
yiciyuan: '异次元',
haikuo: '海阔',
};
module.exports = async (ctx) => {
const name = ctx.params.name || 'yuedu';
const api = `http://ku.mumuceo.com/${name}/index/getlist`;
const response = await got.post(api, {
json: {
page: 1,
limit: 10,
},
});
const data = response.data.data;
ctx.state.data = {
title: `${nameProps[name]} - 源仓库`,
link: 'http://ku.mumuceo.com/',
description: `源仓库 - ${nameProps[name]} RSS`,
item: data.map((item) => ({
title: item.yuansite,
link: `http://ku.mumuceo.com/${name}/detail/index/id/${item.id}.html`,
author: item.username,
pubDate: item.time,
description: item.yuan,
})),
};
};

View File

@@ -25,6 +25,7 @@ module.exports = async (ctx) => {
$('img[src="/system/resource/images/fileTypeImages/icon_xls.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_xls.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_doc.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_doc.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_ppt.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_ppt.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_pdf.gif"]').remove();
const description = $('article.entry-content').html(); const description = $('article.entry-content').html();
const pubDate = $('time').text(); const pubDate = $('time').text();

View File

@@ -29,9 +29,12 @@ module.exports = async (ctx) => {
const other = await ctx.cache.tryGet(link, async () => { const other = await ctx.cache.tryGet(link, async () => {
const result = await got.get(link); const result = await got.get(link);
const $ = cheerio.load(result.data); const $ = cheerio.load(result.data);
$('img[src="/system/resource/images/fileTypeImages/icon_xls.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_xls.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_doc.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_doc.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_ppt.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_ppt.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_pdf.gif"]').remove();
const description = $('#textarea').html(); const description = $('#textarea').html();
const title = $('article > section > form > h2').text(); const title = $('article > section > form > h2').text();
return { return {

View File

@@ -35,6 +35,11 @@ module.exports = async (ctx) => {
$('img[src="/system/resource/images/fileTypeImages/icon_xls.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_xls.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_doc.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_doc.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_ppt.gif"]').remove(); $('img[src="/system/resource/images/fileTypeImages/icon_ppt.gif"]').remove();
$('img[src="/system/resource/images/fileTypeImages/icon_pdf.gif"]').remove();
$('.nr_text')
.find('hr')
.remove();
const delp = $('.nr_text').find('p'); const delp = $('.nr_text').find('p');
delp.eq(-1).remove(); delp.eq(-1).remove();
delp.eq(-2).remove(); delp.eq(-2).remove();