mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-01 09:38:04 +08:00
* refactor(route/jike): rename `common` -> `utils` Signed-off-by: Rongrong <i@rong.moe> * refactor(route/jike): extract repeated logic Signed-off-by: Rongrong <i@rong.moe> * fix(route/jike): lack await Signed-off-by: Rongrong <i@rong.moe>
22 lines
700 B
JavaScript
22 lines
700 B
JavaScript
const dayjs = require('dayjs');
|
|
const { constructTopicEntry } = require('./utils');
|
|
|
|
module.exports = async (ctx) => {
|
|
const id = ctx.params.id;
|
|
const topicUrl = `https://m.okjike.com/topics/${id}`;
|
|
|
|
const data = await constructTopicEntry(ctx, topicUrl);
|
|
|
|
if (data) {
|
|
ctx.state.data.item = data.posts.map((item) => {
|
|
const date = dayjs(item.createdAt);
|
|
return {
|
|
title: `${data.topic.content} ${date.format('MM月DD日')}`,
|
|
description: item.content.replace(/\n/g, '<br>'),
|
|
pubDate: date.toDate(),
|
|
link: `https://m.okjike.com/originalPosts/${item.id}`,
|
|
};
|
|
});
|
|
}
|
|
};
|