mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
feat(route): add Zotero (#9650)
* feat(route): add Zotero * docs: add en docs * docs: use chinese for cn docs
This commit is contained in:
@@ -402,3 +402,9 @@ Refer to [#minecraft](/en/game.html#minecraft)
|
||||
### What's New
|
||||
|
||||
<RouteEn author="nczitzk" example="/xyplorer/whatsnew" path="/xyplorer/whatsnew"/>
|
||||
|
||||
## Zotero
|
||||
|
||||
### Version History
|
||||
|
||||
<RouteEn author="jasongzy" example="/zotero/versions" path="/zotero/versions"/>
|
||||
|
||||
@@ -508,6 +508,12 @@ pageClass: routes
|
||||
|
||||
<Route author="nczitzk" example="/xyplorer/whatsnew" path="/xyplorer/whatsnew"/>
|
||||
|
||||
## Zotero
|
||||
|
||||
### 版本历史
|
||||
|
||||
<Route author="jasongzy" example="/zotero/versions" path="/zotero/versions"/>
|
||||
|
||||
## 怪物猎人世界
|
||||
|
||||
### 更新
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/versions': ['jasongzy'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'zotero.org': {
|
||||
_name: 'Zotero',
|
||||
'.': [
|
||||
{
|
||||
title: 'Version History',
|
||||
docs: 'https://docs.rsshub.app/program-update.html#zotero',
|
||||
source: ['/', '/support/changelog'],
|
||||
target: '/zotero/versions',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/versions', require('./versions'));
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.zotero.org/support/changelog';
|
||||
const response = await got(url);
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('h2');
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Zotero - Version History',
|
||||
link: url,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
let date = $(item)
|
||||
.text()
|
||||
.match(/\((.*)\)/);
|
||||
if (Array.isArray(date)) {
|
||||
date = date[1];
|
||||
} else {
|
||||
date = null;
|
||||
}
|
||||
return {
|
||||
title: item.text().trim(),
|
||||
description: $('<div/>').append(item.nextUntil('h2').clone()).html(),
|
||||
pubDate: date,
|
||||
link: url + '#' + item.attr('id'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user