mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -170,6 +170,10 @@ pageClass: routes
|
||||
|
||||
<Route author="tonghs" example="/manong-weekly" path="/manong-weekly" />
|
||||
|
||||
## 幕布精选
|
||||
|
||||
<Route author="laampui" example="/mubu/explore/16/读书笔记" path="/mubu/explore/:tagId/:title?" :paramsDesc="['标签 id', '显示标题']" />
|
||||
|
||||
## 扇贝
|
||||
|
||||
### 用户打卡
|
||||
|
||||
@@ -3512,6 +3512,9 @@ router.get('/uisdc/news', require('./routes/uisdc/news'));
|
||||
router.get('/uisdc/zt/:title?', require('./routes/uisdc/zt'));
|
||||
router.get('/uisdc/topic/:title?/:sort?', require('./routes/uisdc/topic'));
|
||||
|
||||
// 幕布网
|
||||
router.get('/mubu/explore/:tagId/:title?', require('./routes/mubu/explore'));
|
||||
|
||||
// Esquirehk
|
||||
router.get('/esquirehk/tag/:id', require('./routes/esquirehk/tag'));
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const tagId = ctx.params.tagId;
|
||||
const title = ctx.params.title || '';
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: `https:mubu.com/api/community/query_document`,
|
||||
form: {
|
||||
page: 1,
|
||||
tagId,
|
||||
title: '',
|
||||
type: '',
|
||||
docRecommend: '',
|
||||
},
|
||||
headers: {
|
||||
referer: 'https:mubu.com/explore',
|
||||
},
|
||||
});
|
||||
|
||||
const h = (nodes) => {
|
||||
const list = nodes
|
||||
.map((node) => {
|
||||
let ele = '';
|
||||
if (Array.isArray(node.children)) {
|
||||
ele = h(node.children);
|
||||
}
|
||||
if (Array.isArray(node.images)) {
|
||||
ele += node.images
|
||||
.map((pic) => `https://api2.mubu.com/v3/${pic.uri}`)
|
||||
.map((uri) => `<div style="text-align: center;"><img src="${uri}" style="max-width: 100%;object-fit: contain;" /></div>`)
|
||||
.join('');
|
||||
}
|
||||
|
||||
return `<li>${node.text}${ele}</li>`;
|
||||
})
|
||||
.join('');
|
||||
|
||||
return `<ul>${list}</ul>`;
|
||||
};
|
||||
|
||||
const item = await Promise.all(
|
||||
response.data.data.rows.slice(0, 20).map((item) =>
|
||||
ctx.cache.tryGet(`https://mubu.com/doc/explore/${item.id}`, async () => {
|
||||
const res = await got({
|
||||
method: 'post',
|
||||
url: `https://api2.mubu.com/v3/api/document/view/get`,
|
||||
json: {
|
||||
docId: item.documentId,
|
||||
},
|
||||
headers: {
|
||||
referer: 'https://mubu.com/',
|
||||
},
|
||||
});
|
||||
const content = JSON.parse(res.data.data.definition);
|
||||
const description = h(content.nodes);
|
||||
|
||||
const $ = cheerio.load(description);
|
||||
$('.bold').css('font-weight', 'bold');
|
||||
$('.text-color-red').css('color', '#dc2d1e');
|
||||
|
||||
return {
|
||||
title: item.title,
|
||||
link: `https://mubu.com/doc/explore/${item.id}`,
|
||||
description: `<h2>${item.title}</h2>` + $('*').html(),
|
||||
pubDate: new Date(item.publishTime),
|
||||
author: item.userName,
|
||||
};
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: title ? `幕布 - ${title}` : '幕布',
|
||||
link: `https://mubu.com/explore#${tagId}`,
|
||||
item,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user