mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 02:58:08 +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>
32 lines
990 B
JavaScript
32 lines
990 B
JavaScript
const got = require('@/utils/got');
|
|
const util = require('./utils');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { id } = ctx.params;
|
|
const detail = await got({
|
|
method: 'get',
|
|
url: `https://api.juejin.cn/content_api/v1/column/detail?column_id=${id}`,
|
|
});
|
|
const response = await got({
|
|
method: 'post',
|
|
url: 'https://api.juejin.cn/content_api/v1/column/articles_cursor',
|
|
json: {
|
|
column_id: id,
|
|
limit: 20,
|
|
cursor: '0',
|
|
sort: 0,
|
|
},
|
|
});
|
|
const { data } = response.data;
|
|
const detailData = detail.data.data;
|
|
const columnName = detailData && detailData.column_version && detailData.column_version.title;
|
|
const resultItems = await util.ProcessFeed(data, ctx.cache);
|
|
|
|
ctx.state.data = {
|
|
title: `掘金专栏-${columnName}`,
|
|
link: `https://juejin.cn/column/${id}`,
|
|
description: `掘金专栏-${columnName}`,
|
|
item: resultItems,
|
|
};
|
|
};
|