mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
feat: remove jike, rip
This commit is contained in:
@@ -560,34 +560,6 @@ pageClass: routes
|
||||
|
||||
<Route author="LogicJake" example="/hupu/bbs/bxj/2" path="/hupu/bbs/:id/:order?" :paramsDesc="['板块 id,可在板块 URL 找到', '排序方式,1最新回帖(默认),2最新发帖,3精华帖']"/>
|
||||
|
||||
## 即刻
|
||||
|
||||
### 圈子-精选
|
||||
|
||||
<Route author="DIYgod" example="/jike/topic/54dffb40e4b0f57466e675f0" path="/jike/topic/:id" :paramsDesc="['圈子 id, 可在即刻 web 端圈子页或 APP 分享出来的圈子页 URL 中找到']" anticrawler="1"/>
|
||||
|
||||
::: tip 提示
|
||||
|
||||
部分圈子如 `一觉醒来发生了什么: 553870e8e4b0cafb0a1bef68` 提供纯文字内容, <a href="#/jike/topic/text/:id">圈子-纯文字 /jike/topic/text/:id</a> 可能会提供更好的体验.
|
||||
|
||||
:::
|
||||
|
||||
### 圈子-广场
|
||||
|
||||
<Route author="DIYgod" example="/jike/topic/square/54dffb40e4b0f57466e675f0" path="/jike/topic/square/:id" :paramsDesc="['圈子 id, 可在即刻 web 端圈子页或 APP 分享出来的圈子页 URL 中找到']" anticrawler="1"/>
|
||||
|
||||
### 圈子-纯文字
|
||||
|
||||
<Route author="HenryQW" example="/jike/topic/text/553870e8e4b0cafb0a1bef68" path="/jike/topic/text/:id" :paramsDesc="['圈子 id, 可在即刻 web 端圈子页或 APP 分享出来的圈子页 URL 中找到']" anticrawler="1"/>
|
||||
|
||||
### 用户动态
|
||||
|
||||
<Route author="DIYgod" example="/jike/user/82D23B32-CF36-4C59-AD6F-D05E3552CBF3" path="/jike/user/:id" :paramsDesc="['用户 id, 可在即刻 web 端用户页 URL 中找到']" anticrawler="1"/>
|
||||
|
||||
### 即刻小报
|
||||
|
||||
<Route author="Andiedie" example="/jike/daily" path="/jike/daily" anticrawler="1"/>
|
||||
|
||||
## 简书
|
||||
|
||||
### 首页
|
||||
|
||||
@@ -175,13 +175,6 @@ router.get('/youtube/user/:username/:embed?', require('./routes/youtube/user'));
|
||||
router.get('/youtube/channel/:id/:embed?', require('./routes/youtube/channel'));
|
||||
router.get('/youtube/playlist/:id/:embed?', require('./routes/youtube/playlist'));
|
||||
|
||||
// 即刻
|
||||
router.get('/jike/topic/:id', require('./routes/jike/topic'));
|
||||
router.get('/jike/topic/text/:id', require('./routes/jike/topicText'));
|
||||
router.get('/jike/topic/square/:id', require('./routes/jike/topicSquare'));
|
||||
router.get('/jike/user/:id', require('./routes/jike/user'));
|
||||
router.get('/jike/daily', require('./routes/jike/daily'));
|
||||
|
||||
// 极客时间
|
||||
router.get('/geektime/column/:cid', require('./routes/geektime/column'));
|
||||
router.get('/geektime/news', require('./routes/geektime/news'));
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
const url = require('url');
|
||||
|
||||
module.exports = {
|
||||
emptyResponseCheck: (ctx, data) => {
|
||||
if (data.length === 0) {
|
||||
ctx.state.data = {
|
||||
title: '主题 ID 不存在,或该主题暂无内容',
|
||||
};
|
||||
return true;
|
||||
}
|
||||
},
|
||||
topicDataHanding: (data) =>
|
||||
data.map((item) => {
|
||||
let audioName, videoName, linkName;
|
||||
|
||||
// 获取纯文字内容 和 即刻原文链接
|
||||
let content, link;
|
||||
switch (item.type) {
|
||||
case 'OFFICIAL_MESSAGE':
|
||||
content = item.content;
|
||||
link = `https://web.okjike.com/message-detail/${item.id}/officialMessage`;
|
||||
break;
|
||||
case 'ORIGINAL_POST':
|
||||
content = item.content;
|
||||
link = `https://web.okjike.com/post-detail/${item.id}/originalPost`;
|
||||
break;
|
||||
case 'QUESTION':
|
||||
content = item.title;
|
||||
link = `https://m.okjike.com/questions/${item.id}`;
|
||||
break;
|
||||
default:
|
||||
content = '未知类型,请前往GitHub提交issue';
|
||||
link = 'https://github.com/DIYgod/RSSHub/issues';
|
||||
}
|
||||
|
||||
// rss内容
|
||||
let description = '';
|
||||
|
||||
if (item.linkInfo) {
|
||||
const linkUrl = item.linkInfo.originalLinkUrl || item.linkInfo.linkUrl;
|
||||
|
||||
// 对于即刻抓取的微信公众号文章 特殊处理
|
||||
// 此时 Rss原文链接 变为 微信公众号链接
|
||||
if (url.parse(linkUrl).host === 'mp.weixin.qq.com') {
|
||||
link = linkUrl;
|
||||
}
|
||||
|
||||
// 1. 音频
|
||||
const audioObject = item.linkInfo.audio || item.audio;
|
||||
if (audioObject) {
|
||||
const audioImage = audioObject.image.picUrl || audioObject.image.thumbnailUrl;
|
||||
const audioLink = linkUrl;
|
||||
const audioTitle = audioObject.title;
|
||||
const audioAuthor = audioObject.author;
|
||||
audioName = `${audioTitle} - ${audioAuthor}`;
|
||||
description += `
|
||||
<img referrerpolicy="no-referrer" src="${audioImage}"/>
|
||||
<a href="${audioLink}">${audioName}</a>
|
||||
`;
|
||||
}
|
||||
|
||||
// 2. 视频
|
||||
const videoObject = item.linkInfo.video || item.video;
|
||||
if (videoObject) {
|
||||
const videoImage = videoObject.image.picUrl || videoObject.image.thumbnailUrl;
|
||||
const videoLink = linkUrl;
|
||||
const videoDuration = Math.floor(videoObject.duration / 60000);
|
||||
videoName = item.linkInfo.title;
|
||||
description += `
|
||||
<img referrerpolicy="no-referrer" src="${videoImage}"/>
|
||||
<a href="${videoLink}">${videoName || '观看视频'} - 约${videoDuration}分钟</a>
|
||||
`;
|
||||
}
|
||||
|
||||
// 3. 链接
|
||||
if (!audioObject && !videoObject && linkUrl) {
|
||||
// 部分链接有标题
|
||||
linkName = item.linkInfo.title;
|
||||
const linkTitle = linkName || '访问原文';
|
||||
// 部分链接有缩略图
|
||||
const linkImage = item.linkInfo.pictureUrl;
|
||||
const imageTag = `<img referrerpolicy="no-referrer" src="${linkImage}"/>`;
|
||||
description += `
|
||||
${linkImage ? imageTag : ''}
|
||||
<a href="${linkUrl}">${linkTitle}</a>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 文字内容
|
||||
description += `<br/>${content}`;
|
||||
|
||||
// 5. 图片
|
||||
if (item.pictures) {
|
||||
item.pictures.forEach((pic) => {
|
||||
if (pic.format === 'gif') {
|
||||
description += `<img referrerpolicy="no-referrer" src="${pic.picUrl.split('?imageMogr2/')[0]}"></picture>`;
|
||||
} else {
|
||||
// jpeg, bmp, png, gif, webp
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
|
||||
let type = 'jpeg';
|
||||
switch (pic.format) {
|
||||
case 'bmp':
|
||||
type = 'bmp';
|
||||
break;
|
||||
case 'png':
|
||||
type = 'png';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const imgUrl = pic.picUrl.match(/\.[a-z0-9]+?\?imageMogr2/) ? pic.picUrl.split('?imageMogr2/')[0] : pic.picUrl.replace(/thumbnail\/.+/, '');
|
||||
description += `<br/><picture><source srcset="${
|
||||
pic.picUrl.split('/thumbnail/')[0]
|
||||
}/strip/format/webp" type="image/webp"><source srcset="${imgUrl}" type="image/${type}"><img referrerpolicy="no-referrer" src="${imgUrl}"></picture>`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// rss标题
|
||||
// 优先将音频和视频名作为标题
|
||||
// 其次将正文内容作为标题
|
||||
// 若都没有 则是推送型消息,将连接标题作为主题
|
||||
// “无题” fallback
|
||||
const title = audioName || videoName || content || linkName || '无题';
|
||||
|
||||
return {
|
||||
title,
|
||||
description: description.replace(new RegExp('\n', 'g'), '<br/>'),
|
||||
pubDate: new Date(item.createdAt).toUTCString(),
|
||||
link: link,
|
||||
};
|
||||
}),
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const {
|
||||
data: { data },
|
||||
} = await got.get('https://app.jike.ruguoapp.com/1.0/dailies/list');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '即刻小报',
|
||||
link: 'https://jike.app/',
|
||||
description: '不定期呈现的即刻内容精选',
|
||||
item: data.map((item) => ({
|
||||
title: item.title,
|
||||
description: `<img referrerpolicy="no-referrer" src="${item.picture}">`,
|
||||
pubDate: new Date(item.date).toUTCString(),
|
||||
link: `https://m.okjike.com/dailies/${item.id}`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -1,69 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const common = require('./common');
|
||||
const cheerio = require('cheerio');
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://app.jike.ruguoapp.com/1.0/messages/history',
|
||||
headers: {
|
||||
Referer: `https://m.okjike.com/topics/${id}`,
|
||||
'App-Version': '4.12.0',
|
||||
},
|
||||
json: true,
|
||||
data: {
|
||||
loadMoreKey: null,
|
||||
topic: id,
|
||||
limit: 10,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
if (common.emptyResponseCheck(ctx, data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const topic = data[0].topic;
|
||||
ctx.state.data = {
|
||||
title: `${topic.content} - 即刻主题精选`,
|
||||
link: `https://web.okjike.com/topic/${id}/official`,
|
||||
description: topic.content,
|
||||
image: topic.squarePicture.picUrl || topic.squarePicture.middlePicUrl || topic.squarePicture.thumbnailUrl,
|
||||
item: common.topicDataHanding(data),
|
||||
};
|
||||
if (id === '553870e8e4b0cafb0a1bef68' || id === '55963702e4b0d84d2c30ce6f') {
|
||||
const promises = ctx.state.data.item.map(async (one) => {
|
||||
const item = { ...one };
|
||||
const regResult = /https:\/\/www.okjike.com\/medium\/[a-zA-Z0-9]*/.exec(item.description);
|
||||
if (regResult) {
|
||||
const newsUrl = regResult[0];
|
||||
const cache = await ctx.cache.get(newsUrl);
|
||||
if (cache) {
|
||||
item.description = cache;
|
||||
} else {
|
||||
const { data } = await got.get(newsUrl);
|
||||
const $ = cheerio.load(data);
|
||||
const upper = $('ul.main > li.item');
|
||||
const links = upper.find('a').map((_, ele) => $(ele).attr('href'));
|
||||
const texts = upper.find('span.text').map((_, ele) => $(ele).text());
|
||||
let description = '';
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
description += `${i + 1}、<a href="${links[i]}">${texts[i]}</a><br/>`;
|
||||
}
|
||||
if (description) {
|
||||
item.description = description;
|
||||
await ctx.cache.set(newsUrl, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
item.title = `${topic.content} ${dayjs(new Date(one.pubDate)).format('MM月DD日')}`;
|
||||
return item;
|
||||
});
|
||||
|
||||
ctx.state.data.item = await Promise.all(promises);
|
||||
}
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const common = require('./common');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://app.jike.ruguoapp.com/1.0/squarePosts/list',
|
||||
headers: {
|
||||
Referer: `https://m.okjike.com/topics/${id}`,
|
||||
'App-Version': '4.12.0',
|
||||
},
|
||||
json: true,
|
||||
data: {
|
||||
loadMoreKey: null,
|
||||
topicId: id,
|
||||
limit: 20,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
if (common.emptyResponseCheck(ctx, data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const topic = data[0].topic;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${topic.content} - 即刻主题广场`,
|
||||
link: `https://web.okjike.com/topic/${id}/user`,
|
||||
description: topic.content,
|
||||
image: topic.squarePicture.picUrl || topic.squarePicture.middlePicUrl || topic.squarePicture.thumbnailUrl,
|
||||
item: common.topicDataHanding(data),
|
||||
};
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const dayjs = require('dayjs');
|
||||
const common = require('./common');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://app.jike.ruguoapp.com/1.0/messages/history',
|
||||
headers: {
|
||||
Referer: `https://m.okjike.com/topics/${id}`,
|
||||
'App-Version': '4.12.0',
|
||||
},
|
||||
json: true,
|
||||
data: {
|
||||
loadMoreKey: null,
|
||||
topic: id,
|
||||
limit: 5,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
if (common.emptyResponseCheck(ctx, data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = data[0].topic.content;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${title} - 即刻`,
|
||||
link: `https://web.okjike.com/topic/${id}/official`,
|
||||
description: `${title} - 即刻`,
|
||||
item: data.map((item) => {
|
||||
const date = new Date(item.createdAt);
|
||||
return {
|
||||
title: `${title} ${dayjs(date).format('MM月DD日')}`,
|
||||
description: item.content.replace(new RegExp('\n', 'g'), '<br />'),
|
||||
pubDate: date.toUTCString(),
|
||||
link: `https://web.okjike.com/message-detail/${item.id}/officialMessage`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
@@ -1,114 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://app.jike.ruguoapp.com/1.0/personalUpdate/single',
|
||||
headers: {
|
||||
Referer: `https://web.okjike.com/user/${id}/post`,
|
||||
'App-Version': '4.12.0',
|
||||
platform: 'web',
|
||||
},
|
||||
json: true,
|
||||
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: '转发',
|
||||
ANSWER: '回答',
|
||||
QUESTION: '提问',
|
||||
PERSONAL_UPDATE: '创建新主题',
|
||||
};
|
||||
|
||||
const linkMap = {
|
||||
OFFICIAL_MESSAGE: `https://web.okjike.com/message-detail/${item.id}/officialMessage`,
|
||||
ORIGINAL_POST: `https://web.okjike.com/post-detail/${item.id}/originalPost`,
|
||||
REPOST: `https://web.okjike.com/post-detail/${item.id}/repost`,
|
||||
ANSWER: `https://m.okjike.com/answers/${item.id}`,
|
||||
QUESTION: `https://m.okjike.com/questions/${item.id}`,
|
||||
PERSONAL_UPDATE: `https://web.okjike.com/topic/${item.topic && item.topic.id}/official`,
|
||||
};
|
||||
|
||||
let linkTemplate = '';
|
||||
if (item.linkInfo && item.linkInfo.linkUrl) {
|
||||
linkTemplate = `<a href="${item.linkInfo.linkUrl}">${item.linkInfo.title}</a><br>`;
|
||||
}
|
||||
|
||||
let imgTemplate = '';
|
||||
item.pictures &&
|
||||
item.pictures.forEach((item) => {
|
||||
imgTemplate += `<img referrerpolicy="no-referrer" src="${item.picUrl}"><br>`;
|
||||
});
|
||||
|
||||
let content = item.content || (item.linkInfo && item.linkInfo.title) || (item.question && item.question.title) || item.title || '';
|
||||
|
||||
let shortenTitle = '一条动态';
|
||||
if (content) {
|
||||
shortenTitle = content.length > 75 ? `${content.substr(0, 75)}...` : content;
|
||||
content = `${content}<br><br>`;
|
||||
}
|
||||
|
||||
if (item.type === 'REPOST') {
|
||||
const screenNameTemplate = item.target.user ? `<a href="https://web.okjike.com/user/${item.target.user.username}/post" target="_blank">@${item.target.user.screenName}</a>` : '';
|
||||
|
||||
let repostImgTemplate = '';
|
||||
item.target.pictures &&
|
||||
item.target.pictures.forEach((item) => {
|
||||
repostImgTemplate += `<br><img referrerpolicy="no-referrer" src="${item.thumbnailUrl}">`;
|
||||
});
|
||||
|
||||
const repostContent = `转发 ${screenNameTemplate}: ${item.target.content}${repostImgTemplate}`;
|
||||
content = `${content}${repostContent}`.replace(/\n|\r/g, '<br>');
|
||||
} else if (item.type === 'ANSWER') {
|
||||
let answerTextTemplate = '';
|
||||
let answerImgTemplate = '';
|
||||
let answerImgKeys = [];
|
||||
item.richtextContent.blocks &&
|
||||
item.richtextContent.blocks.forEach((item) => {
|
||||
if (item.entityRanges.length && item.text === '[图片]') {
|
||||
answerImgKeys = [...answerImgKeys, ...Object.keys(item.entityRanges)];
|
||||
} else {
|
||||
answerTextTemplate += item.text;
|
||||
}
|
||||
});
|
||||
|
||||
if (answerImgKeys.length) {
|
||||
answerImgKeys.forEach((key) => {
|
||||
const entity = item.richtextContent.entityMap[key];
|
||||
if (entity.type.toUpperCase() === 'IMAGE') {
|
||||
answerImgTemplate += `<br><img referrerpolicy="no-referrer" src="${entity.data.pictureUrl.middlePicUrl}">`;
|
||||
}
|
||||
});
|
||||
}
|
||||
const answerContent = `回答: ${answerTextTemplate}${answerImgTemplate}`;
|
||||
content = `${content}${answerContent}`.replace(/\n|\r/g, '<br>');
|
||||
} else if (item.type === 'QUESTION') {
|
||||
content = `在主题 <a href="https://web.okjike.com/topic/${item.topic.id}/official" target="_blank">${item.topic.content}</a> 提出了一个问题:<br><br>${content}`;
|
||||
} else if (item.type === 'PERSONAL_UPDATE') {
|
||||
shortenTitle = item.topic.content;
|
||||
content = `<img referrerpolicy="no-referrer" src="${item.topic.squarePicture.picUrl}"> 主题简介:<br>${item.topic.briefIntro.replace(/(?:\r\n|\r|\n)/g, '<br>')}`;
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${typeMap[item.type]}了: ${shortenTitle}`,
|
||||
description: `${content}${linkTemplate}${imgTemplate}`,
|
||||
pubDate: new Date(item.createdAt).toUTCString(),
|
||||
link: `${linkMap[item.type]}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user