mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
feat: 新增路由「Hpoi 手办维基」 (#2120)
* feat: 新增路由 「Hpoi 手办维基」/hpoi/:category/:words * fix: delete console.log
This commit is contained in:
@@ -80,6 +80,18 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="Tsuki" example="/ebb" path="/ebb"/>
|
<Route author="Tsuki" example="/ebb" path="/ebb"/>
|
||||||
|
|
||||||
|
## Hpoi 手办维基
|
||||||
|
|
||||||
|
### 浏览周边
|
||||||
|
|
||||||
|
<Route author="howel52" path="/hpoi/:category/:words" example="/hpoi/charactar/1246512" :paramsDesc="['分类, 见下表', '关键词']">
|
||||||
|
|
||||||
|
| 角色手办 | 作品手办 |
|
||||||
|
| --------- | -------- |
|
||||||
|
| charactar | works |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## say 花火
|
## say 花火
|
||||||
|
|
||||||
### 文章
|
### 文章
|
||||||
|
|||||||
@@ -1361,6 +1361,9 @@ router.get('/manhuadb/comics/:id', require('./routes/manhuadb/comics'));
|
|||||||
// 观察者风闻话题
|
// 观察者风闻话题
|
||||||
router.get('/guanchazhe/topic/:id', require('./routes/guanchazhe/topic'));
|
router.get('/guanchazhe/topic/:id', require('./routes/guanchazhe/topic'));
|
||||||
|
|
||||||
|
// Hpoi 手办维基
|
||||||
|
router.get('/hpoi/:category/:words', require('./routes/hpoi'));
|
||||||
|
|
||||||
// 通用CurseForge
|
// 通用CurseForge
|
||||||
router.get('/curseforge/:gameid/:catagoryid/:projectid/files', require('./routes/curseforge/generalfiles'));
|
router.get('/curseforge/:gameid/:catagoryid/:projectid/files', require('./routes/curseforge/generalfiles'));
|
||||||
|
|
||||||
|
|||||||
41
lib/routes/hpoi/index.js
Normal file
41
lib/routes/hpoi/index.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
const host = 'https://www.hpoi.net';
|
||||||
|
|
||||||
|
const MAPs = {
|
||||||
|
charactar: {
|
||||||
|
url: `${host}/hobby/all?charactar={words}&order=release`,
|
||||||
|
title: '角色手办',
|
||||||
|
},
|
||||||
|
works: {
|
||||||
|
url: `${host}/hobby/all?works={words}&order=release`,
|
||||||
|
title: '作品手办',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const category = ctx.params && ctx.params.category;
|
||||||
|
const words = ctx.params && ctx.params.words;
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: MAPs[category].url.replace(/{words}/, words),
|
||||||
|
headers: {
|
||||||
|
Referer: host,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
ctx.state.data = {
|
||||||
|
title: MAPs[category].title + ' - ' + $('title').text(),
|
||||||
|
item: $('.bs-glyphicons-list .detail-grid')
|
||||||
|
.map((_index, _item) => {
|
||||||
|
_item = $(_item);
|
||||||
|
return {
|
||||||
|
title: _item.find('.detail-grid-title').text(),
|
||||||
|
link: host + '/' + _item.find('.detail-grid-title a').attr('href'),
|
||||||
|
description: _item.find('.detail-grid-info').text(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get(),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user