mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
feat: add 印象识堂用户公开笔记 & 笔记分类 & 笔记标签 (#6414)
This commit is contained in:
@@ -399,6 +399,18 @@ pageClass: routes
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
### 用户公开笔记
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/yinxiang/personal/ZUhuRTmW5SKE7vvHPqI7cg" path="/yinxiang/personal/:id" :paramsDesc="['用户 id,可在用户页 URL 中找到']" />
|
||||||
|
|
||||||
|
### 笔记分类
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/yinxiang/category/28" path="/yinxiang/category/:id" :paramsDesc="['分类 id,可在分类页 URL 中找到']" />
|
||||||
|
|
||||||
|
### 笔记标签
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/yinxiang/tag/人生算法" path="/yinxiang/tag/:id" :paramsDesc="['标签名,可在标签页中找到']" />
|
||||||
|
|
||||||
## 英中协会
|
## 英中协会
|
||||||
|
|
||||||
### 奖学金
|
### 奖学金
|
||||||
|
|||||||
@@ -3639,7 +3639,10 @@ router.get('/youdao/latest', require('./routes/youdao/latest'));
|
|||||||
|
|
||||||
// 印象识堂
|
// 印象识堂
|
||||||
router.get('/yinxiang/note', require('./routes/yinxiang/note'));
|
router.get('/yinxiang/note', require('./routes/yinxiang/note'));
|
||||||
router.get('/yinxiang/card/:id?', require('./routes/yinxiang/card'));
|
router.get('/yinxiang/tag/:id', require('./routes/yinxiang/tag'));
|
||||||
|
router.get('/yinxiang/card/:id', require('./routes/yinxiang/card'));
|
||||||
|
router.get('/yinxiang/personal/:id', require('./routes/yinxiang/personal'));
|
||||||
|
router.get('/yinxiang/category/:id', require('./routes/yinxiang/category'));
|
||||||
|
|
||||||
// 晚点LatePost
|
// 晚点LatePost
|
||||||
router.get('/latepost/:proma?', require('./routes/latepost/index'));
|
router.get('/latepost/:proma?', require('./routes/latepost/index'));
|
||||||
|
|||||||
47
lib/routes/yinxiang/category.js
Normal file
47
lib/routes/yinxiang/category.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
|
||||||
|
const apiUrl = `https://app.yinxiang.com/third/discovery/client/restful/public/category/page?notePageSize=20&lastBlogNoteGuid=&cateGoryId=${id}`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: apiUrl,
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = response.data.categoryNoteSnapshotReply.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
link: item.noteGuid,
|
||||||
|
author: item.userNickname,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
list.map(
|
||||||
|
async (item) =>
|
||||||
|
await ctx.cache.tryGet(item.link, async () => {
|
||||||
|
const detailResponse = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://app.yinxiang.com/third/discovery/client/restful/public/blog-note?noteGuid=${item.link}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
item.link = `https://www.yinxiang.com/everhub/note/${item.link}`;
|
||||||
|
item.pubDate = new Date(parseInt(detailResponse.data.blogNote.publishTime)).toUTCString();
|
||||||
|
|
||||||
|
const description = detailResponse.data.blogNote.htmlContent;
|
||||||
|
if (description.indexOf('<?xml') < 0) {
|
||||||
|
item.description = description;
|
||||||
|
} else {
|
||||||
|
item.description = description.match(/<en-note>(.*)<\/en-note>/)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${response.data.categoryName} - 印象识堂`,
|
||||||
|
link: `https://www.yinxiang.com/everhub/category/${id}`,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
48
lib/routes/yinxiang/personal.js
Normal file
48
lib/routes/yinxiang/personal.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
|
||||||
|
const apiUrl = `https://app.yinxiang.com/third/discovery/client/restful/public/blog-user/homepage?encryptedUserId=${id}&lastNoteGuid=¬ePageSize=20`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: apiUrl,
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = response.data.blogNote.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
link: item.noteGuid,
|
||||||
|
author: item.userNickname,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
list.map(
|
||||||
|
async (item) =>
|
||||||
|
await ctx.cache.tryGet(item.link, async () => {
|
||||||
|
const detailResponse = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://app.yinxiang.com/third/discovery/client/restful/public/blog-note?noteGuid=${item.link}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
item.link = `https://www.yinxiang.com/everhub/note/${item.link}`;
|
||||||
|
item.pubDate = new Date(parseInt(detailResponse.data.blogNote.publishTime)).toUTCString();
|
||||||
|
|
||||||
|
const description = detailResponse.data.blogNote.htmlContent;
|
||||||
|
if (description.indexOf('<?xml') < 0) {
|
||||||
|
item.description = description;
|
||||||
|
} else {
|
||||||
|
item.description = description.match(/<en-note>(.*)<\/en-note>/)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${response.data.blogUser.nickname} - 印象识堂`,
|
||||||
|
link: `https://www.yinxiang.com/everhub/category/${id}`,
|
||||||
|
description: response.data.blogUser.introduction,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
47
lib/routes/yinxiang/tag.js
Normal file
47
lib/routes/yinxiang/tag.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
|
||||||
|
const apiUrl = `https://app.yinxiang.com/third/discovery/client/restful/public/tag/note?pageSize=20&tagName=${id}`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: apiUrl,
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = response.data.blogNote.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
link: item.noteGuid,
|
||||||
|
author: item.userNickname,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
list.map(
|
||||||
|
async (item) =>
|
||||||
|
await ctx.cache.tryGet(item.link, async () => {
|
||||||
|
const detailResponse = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://app.yinxiang.com/third/discovery/client/restful/public/blog-note?noteGuid=${item.link}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
item.link = `https://www.yinxiang.com/everhub/note/${item.link}`;
|
||||||
|
item.pubDate = new Date(parseInt(detailResponse.data.blogNote.publishTime)).toUTCString();
|
||||||
|
|
||||||
|
const description = detailResponse.data.blogNote.htmlContent;
|
||||||
|
if (description.indexOf('<?xml') < 0) {
|
||||||
|
item.description = description;
|
||||||
|
} else {
|
||||||
|
item.description = description.match(/<en-note>(.*)<\/en-note>/)[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${response.data.tagInfo.name} - 印象识堂`,
|
||||||
|
link: `https://www.yinxiang.com/everhub/tagtheme/${id}`,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user