mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
feat: AI研习社添加参数 (#2416)
* enhance: AI研习社添加参数 * 支持查看不同领域 * 排序方式 * fix warning * enhance: 添加更多类别
This commit is contained in:
@@ -6,9 +6,9 @@ pageClass: routes
|
||||
|
||||
## 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
|
||||
|
||||
|
||||
@@ -1419,6 +1419,6 @@ router.get('/outagereport/:name/:count?', require('./routes/outagereport/service
|
||||
router.get('/sixthtone/news', require('./routes/sixthtone/news'));
|
||||
|
||||
// AI研习社
|
||||
router.get('/aiyanxishe/', require('./routes/aiyanxishe/home'));
|
||||
router.get('/aiyanxishe/:id/:sort?', require('./routes/aiyanxishe/home'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
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({
|
||||
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: {
|
||||
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