Files
RSSHub/lib/routes/jamesclear/utils.ts
T
Nishant Singh 35caf4da42 feat(route/jamesclear): add jamesClear (#19589)
* init

* fix maintain

* Update lib/routes/jamesclear/utils.ts
2025-07-16 21:45:03 +08:00

23 lines
647 B
TypeScript

import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import { DataItem } from '@/types';
export const rootUrl = 'https://jamesclear.com';
export const apiUrl = `${rootUrl}/wp-json/wp/v2`;
export async function fetchContent(endpoint: string) {
const response = await ofetch(`${apiUrl}/${endpoint}`);
return response;
}
export function processItem(item: any): DataItem {
return {
title: item.title.rendered,
link: item.link,
description: item.content.rendered,
pubDate: parseDate(item.date_gmt),
author: 'James Clear',
guid: item.guid.rendered,
};
}