mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: juejin pins (#5323)
This commit is contained in:
+26
-37
@@ -3,53 +3,42 @@ const got = require('@/utils/got');
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://web-api.juejin.im/graphql',
|
||||
json: { operationName: '', query: '', variables: { size: 20, after: '', afterPosition: '' }, extensions: { query: { id: '964dab26a3f9997283d173b865509890' } } },
|
||||
headers: {
|
||||
'X-Agent': 'Juejin/Web',
|
||||
},
|
||||
url: 'https://apinew.juejin.im/recommend_api/v1/short_msg/recommend',
|
||||
json: true,
|
||||
data: { id_type: 4, sort_type: 300, cursor: '0', limit: 20 },
|
||||
});
|
||||
|
||||
const items = response.data.data.recommendedActivityFeed.items.edges.map(
|
||||
({
|
||||
node: {
|
||||
targets: [item],
|
||||
},
|
||||
}) => {
|
||||
const content = item.content;
|
||||
const title = content;
|
||||
const guid = item.id;
|
||||
const link = `https://juejin.im/pin/${guid}`;
|
||||
const pubDate = new Date(item.createdAt).toUTCString();
|
||||
const author = item.user.username;
|
||||
const imgs = item.pictures.reduce((imgs, item) => {
|
||||
imgs += `
|
||||
const items = response.data.data.map((item) => {
|
||||
const content = item.msg_Info.content;
|
||||
const title = content;
|
||||
const guid = item.msg_id;
|
||||
const link = `https://juejin.im/pin/${guid}`;
|
||||
const pubDate = new Date(parseInt(item.msg_Info.ctime) * 1000).toUTCString();
|
||||
const author = item.author_user_info.user_name;
|
||||
const imgs = item.msg_Info.pic_list.reduce((imgs, item) => {
|
||||
imgs += `
|
||||
<img src="${item}"><br>
|
||||
`;
|
||||
return imgs;
|
||||
}, '');
|
||||
const url = item.url;
|
||||
const urlTitle = item.urlTitle;
|
||||
const description = `
|
||||
return imgs;
|
||||
}, '');
|
||||
const description = `
|
||||
${content.replace(/\n/g, '<br>')}<br>
|
||||
${imgs}<br>
|
||||
<a href="${url}">${urlTitle}</a><br>
|
||||
`;
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
guid,
|
||||
pubDate,
|
||||
author,
|
||||
};
|
||||
}
|
||||
);
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
guid,
|
||||
pubDate,
|
||||
author,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: '沸点 - 动态',
|
||||
link: 'https://juejin.im/activities/recommended',
|
||||
title: '沸点 - 推荐',
|
||||
link: 'https://juejin.im/pins/recommended',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user