mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 11:37:44 +08:00
RSS: jike topic and user
This commit is contained in:
@@ -27,6 +27,9 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 微博
|
||||
- 博主
|
||||
- 关键词
|
||||
- 即刻
|
||||
- 主题
|
||||
- 用户动态
|
||||
- 网易云音乐
|
||||
- 歌单歌曲
|
||||
- 用户歌单
|
||||
|
||||
@@ -203,6 +203,24 @@ s
|
||||
|
||||
参数: keyword,你想订阅的微博关键词
|
||||
|
||||
## 即刻
|
||||
|
||||
### 主题
|
||||
|
||||
举例: [https://rss.now.sh/jike/topic/54dffb40e4b0f57466e675f0](https://rss.now.sh/jike/topic/54dffb40e4b0f57466e675f0)
|
||||
|
||||
路由: `/jike/topic/:id`
|
||||
|
||||
参数: id,主题 id,可在即刻 web 端主题页或 APP 分享出来的主题页 URL 中找到
|
||||
|
||||
### 用户动态
|
||||
|
||||
举例: [https://rss.now.sh/jike/user/82D23B32-CF36-4C59-AD6F-D05E3552CBF3](https://rss.now.sh/jike/user/82D23B32-CF36-4C59-AD6F-D05E3552CBF3)
|
||||
|
||||
路由: `/jike/user/:id`
|
||||
|
||||
参数: id,用户 id,可在即刻 web 端用户页 URL 中找到
|
||||
|
||||
## 网易云音乐
|
||||
|
||||
### 歌单歌曲
|
||||
|
||||
@@ -108,4 +108,8 @@ router.get('/instagram/user/:id', require('./routes/instagram/user'));
|
||||
router.get('/youtube/user/:username', require('./routes/youtube/user'));
|
||||
router.get('/youtube/channel/:id', require('./routes/youtube/channel'));
|
||||
|
||||
// 即刻
|
||||
router.get('/jike/topic/:id', require('./routes/jike/topic'));
|
||||
router.get('/jike/user/:id', require('./routes/jike/user'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
56
routes/jike/topic.js
Normal file
56
routes/jike/topic.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const axios = require('axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: `https://app.jike.ruguoapp.com/1.0/messages/showDetail?topicId=${id}`,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': `https://m.okjike.com/topics/${id}`,
|
||||
'App-Version': '3.5.0'
|
||||
}
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
ctx.state.data = {
|
||||
title: data.topic.content,
|
||||
link: `https://web.okjike.com/topic/${id}/official`,
|
||||
description: data.topic.briefIntro,
|
||||
image: data.topic.pictureUrl,
|
||||
item: data.messages.map((item) => {
|
||||
let contentTemplate = item.content;
|
||||
if (item.linkUrl) {
|
||||
contentTemplate = `<a href="${item.linkUrl}">${item.content}</a>`;
|
||||
}
|
||||
if (item.personalUpdate && item.personalUpdate.linkUrl) {
|
||||
contentTemplate = `<a href="${item.personalUpdate.linkUrl}">${item.content}</a>`;
|
||||
}
|
||||
|
||||
let imgTemplate = '';
|
||||
item.pictureUrls && item.pictureUrls.forEach((item) => {
|
||||
imgTemplate += `<br><img referrerpolicy="no-referrer" src="${item.picUrl}">`;
|
||||
});
|
||||
item.personalUpdate && item.personalUpdate.pictureUrls && item.personalUpdate.pictureUrls.forEach((item) => {
|
||||
imgTemplate += `<br><img referrerpolicy="no-referrer" src="${item.picUrl}">`;
|
||||
});
|
||||
|
||||
let videoTemplate = '';
|
||||
if (item.video) {
|
||||
videoTemplate = `<br>视频: <img referrerpolicy="no-referrer" src="${item.video.image.picUrl}">`;
|
||||
}
|
||||
if (item.personalUpdate && item.personalUpdate.video) {
|
||||
videoTemplate = `<br>视频: <img referrerpolicy="no-referrer" src="${item.personalUpdate.video.image.picUrl}">`;
|
||||
}
|
||||
return {
|
||||
title: item.content,
|
||||
description: `${contentTemplate}${imgTemplate}${videoTemplate}`,
|
||||
pubDate: new Date(item.createdAt).toUTCString(),
|
||||
link: `https://web.okjike.com/message-detail/${item.id}/officialMessage`
|
||||
}
|
||||
}),
|
||||
};
|
||||
};
|
||||
54
routes/jike/user.js
Normal file
54
routes/jike/user.js
Normal file
@@ -0,0 +1,54 @@
|
||||
const axios = require('axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await axios({
|
||||
method: 'post',
|
||||
url: 'https://app.jike.ruguoapp.com/1.0/personalUpdate/single',
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': `https://web.okjike.com/user/${id}`,
|
||||
'App-Version': '4.1.0',
|
||||
'platform': 'web'
|
||||
},
|
||||
data: {
|
||||
limit: 20,
|
||||
loadMoreKey: null,
|
||||
username: id
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data[0].user.screenName}的即刻动态`,
|
||||
link: `https://web.okjike.com/user/${id}`,
|
||||
image: data[0].user.avatarImage.picUrl,
|
||||
item: data.map((item) => {
|
||||
const typeMap = {
|
||||
'ORIGINAL_POST': '发布',
|
||||
'REPOST': '转发'
|
||||
};
|
||||
|
||||
let linkTemplate = '';
|
||||
if (item.linkInfo && item.linkInfo.linkUrl) {
|
||||
linkTemplate = `<br><a href="${item.linkInfo.linkUrl}">${item.linkInfo.title}</a>`;
|
||||
}
|
||||
|
||||
let imgTemplate = '';
|
||||
item.pictures && item.pictures.forEach((item) => {
|
||||
imgTemplate += `<br><img referrerpolicy="no-referrer" src="${item.picUrl}">`;
|
||||
});
|
||||
|
||||
const content = item.content || item.linkInfo && item.linkInfo.title || item.target && item.target.content;
|
||||
return {
|
||||
title: `${typeMap[item.type]}了: ${content}`,
|
||||
description: `${content}${linkTemplate}${imgTemplate}`,
|
||||
pubDate: new Date(item.createdAt).toUTCString(),
|
||||
link: `https://web.okjike.com/message-detail/${item.id}/officialMessage`
|
||||
}
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user