mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
24 lines
761 B
TypeScript
24 lines
761 B
TypeScript
import dayjs from 'dayjs';
|
|
import { constructTopicEntry } from './utils';
|
|
|
|
export default async (ctx) => {
|
|
const id = ctx.req.param('id');
|
|
const topicUrl = `https://m.okjike.com/topics/${id}`;
|
|
|
|
const data = await constructTopicEntry(ctx, topicUrl);
|
|
|
|
if (data) {
|
|
const result = ctx.get('data');
|
|
result.item = data.posts.map((item) => {
|
|
const date = dayjs(item.createdAt);
|
|
return {
|
|
title: `${data.topic.content} ${date.format('MM月DD日')}`,
|
|
description: item.content.replaceAll('\n', '<br>'),
|
|
pubDate: date.toDate(),
|
|
link: `https://m.okjike.com/originalPosts/${item.id}`,
|
|
};
|
|
});
|
|
ctx.set('data', result);
|
|
}
|
|
};
|