mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 04:11:26 +08:00
* feat(route): add juejin news * feat(route): add juejin news * fix(route): juejin news pubDate * fix: fix utility * refactor: migrate to v2 * fix: typo Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
26 lines
753 B
JavaScript
26 lines
753 B
JavaScript
const got = require('@/utils/got');
|
|
const util = require('./utils');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { id } = ctx.params;
|
|
|
|
const response = await got({
|
|
method: 'post',
|
|
url: 'https://api.juejin.cn/content_api/v1/article/query_list',
|
|
json: {
|
|
user_id: id,
|
|
sort_type: 2,
|
|
},
|
|
});
|
|
const { data } = response.data;
|
|
const username = data[0] && data[0].author_user_info && data[0].author_user_info.user_name;
|
|
const resultItems = await util.ProcessFeed(data, ctx.cache);
|
|
|
|
ctx.state.data = {
|
|
title: `掘金专栏-${username}`,
|
|
link: `https://juejin.cn/user/${id}/posts`,
|
|
description: `掘金专栏-${username}`,
|
|
item: resultItems,
|
|
};
|
|
};
|