mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 15:21:59 +08:00
feat: AI研习社添加参数 (#2416)
* enhance: AI研习社添加参数 * 支持查看不同领域 * 排序方式 * fix warning * enhance: 添加更多类别
This commit is contained in:
@@ -6,9 +6,9 @@ pageClass: routes
|
|||||||
|
|
||||||
## AI 研习社
|
## AI 研习社
|
||||||
|
|
||||||
### 最新
|
### 首页
|
||||||
|
|
||||||
<Route author="kt286" example="/aiyanxishe" path="/aiyanxishe"/>
|
<Route author="kt286" example="/aiyanxishe/109/hot" path="/aiyanxishe/:id/:sort?" :paramsDesc="['领域 id,全部领域为 all,单独领域 id 抓包可得','排序方式,默认为 new(最新),也可选择 hot(最热)或 recommend(推荐)']"/>
|
||||||
|
|
||||||
## AlgoCasts
|
## AlgoCasts
|
||||||
|
|
||||||
|
|||||||
@@ -1419,6 +1419,6 @@ router.get('/outagereport/:name/:count?', require('./routes/outagereport/service
|
|||||||
router.get('/sixthtone/news', require('./routes/sixthtone/news'));
|
router.get('/sixthtone/news', require('./routes/sixthtone/news'));
|
||||||
|
|
||||||
// AI研习社
|
// AI研习社
|
||||||
router.get('/aiyanxishe/', require('./routes/aiyanxishe/home'));
|
router.get('/aiyanxishe/:id/:sort?', require('./routes/aiyanxishe/home'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -1,9 +1,27 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
const sort = ctx.params.sort || 'new';
|
||||||
|
|
||||||
|
let url = 'https://www.leiphone.com/club/api?page=1&size=30&parent_tag=';
|
||||||
|
|
||||||
|
if (id === 'all') {
|
||||||
|
url += '&tag=';
|
||||||
|
} else {
|
||||||
|
url += `&tag=${id}`;
|
||||||
|
}
|
||||||
|
if (sort === 'hot') {
|
||||||
|
url += '&is_hot=1&is_recommend=0';
|
||||||
|
} else if (sort === 'recommend') {
|
||||||
|
url += '&is_hot=0&is_recommend=1';
|
||||||
|
} else {
|
||||||
|
url += '&is_hot=0&is_recommend=0';
|
||||||
|
}
|
||||||
|
|
||||||
const response = await got({
|
const response = await got({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: 'https://www.leiphone.com/club/api?page=1&size=30&is_hot=0&is_recommend=0&tag=&parent_tag=',
|
url: url,
|
||||||
headers: {
|
headers: {
|
||||||
Referer: `https://www.leiphone.com/club/api?page=1&size=30&is_hot=0&is_recommend=0&tag=&parent_tag='`,
|
Referer: `https://www.leiphone.com/club/api?page=1&size=30&is_hot=0&is_recommend=0&tag=&parent_tag='`,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user