feat: add Quicker (#5259)

Co-authored-by: root <root@DESKTOP-G9ROLIE.localdomain>
This commit is contained in:
cesaryuan
2020-07-28 16:24:11 +01:00
committed by GitHub
co-authored by root
parent c78638e503
commit 426d869bf0
5 changed files with 87 additions and 0 deletions
+6
View File
@@ -118,6 +118,12 @@ pageClass: routes
<Route author="xyqfer" example="/nga/post/18449558" path="/nga/post/:tid" :paramsDesc="['帖子 id, 可在帖子 URL 找到']" radar="1"/>
## Quicker
### 讨论区
<Route author="Cesaryuan" example="/quicker/qa" path="/quicker/qa"/>
## RF 技术社区
### 文章
+6
View File
@@ -196,6 +196,12 @@ pageClass: routes
见 [#playstation](/game.html#playstation)
## Quicker
### 版本更新
<Route author="Cesaryuan" example="/quicker/update" path="/quicker/update"/>
## RSSHub
### 有新路由啦
+4
View File
@@ -42,6 +42,10 @@ router.get('/rsshub/sponsors', require('./routes/rsshub/sponsors'));
// 1draw
router.get('/1draw', require('./routes/1draw/index'));
// quicker
router.get('/quicker/qa', require('./routes/quicker/qa.js'));
router.get('/quicker/update', require('./routes/quicker/update.js'));
// bilibili
router.get('/bilibili/user/video/:uid/:disableEmbed?', require('./routes/bilibili/video'));
router.get('/bilibili/user/article/:uid', require('./routes/bilibili/article'));
+41
View File
@@ -0,0 +1,41 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://getquicker.net/QA',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('div.question-title > a');
const out = await Promise.all(
list
.map(async (index, item) => {
item = $(item);
const response_item = await got({
method: 'get',
url: 'https://getquicker.net' + item.attr('href'),
});
const a = cheerio.load(response_item.data);
return Promise.resolve({
title: item.text(),
description: `作者:${a('.user-link').first().text()}<br>描述:${a('.user-content').first().html()}`,
pubDate:
a('.user-content span')
.last()
.text()
.match(/最后更新于\s*\S+/) || '1900/1/1',
link: item.attr('href'),
});
})
.get()
);
ctx.state.data = {
title: '讨论区 - Quicker',
link: 'https://getquicker.net/QA',
item: out,
};
};
+30
View File
@@ -0,0 +1,30 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://getquicker.net/Help/Versions',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('div.version-list > div');
const out = list
.map((index, item) => {
item = $(item);
return {
title: item.find('h2 > a').text(),
description: item.find('div.article-content').html(),
pubDate: item.find('div > span.text-secondary.d-lg-block.mb-2').text() || '1900/1/1',
link: item.find('h2 > a').attr('href'),
};
})
.get();
ctx.state.data = {
title: '版本更新 - Quicker',
link: 'https://getquicker.net/Help/Versions',
item: out,
};
};