Files
RSSHub/lib/routes/yystv/fetcher.ts
T
Jiahao Lee 8c16cf41a7 fix(route/yystv): fix cache collisions (#18739)
* fix(route/yystv): fix cache collisions induced by these two implementations

* chore(route/yystv): prefer existing types over new types

* fix(route/yystv): prefer caching processed items over raw web pages

* docs: fix maintainer github id

---------
2025-04-02 03:10:56 +08:00

11 lines
377 B
TypeScript

import { DataItem } from '@/types';
import cache from '@/utils/cache';
import ofetch from '@/utils/ofetch';
export function fetchDataItemCached(link: string, processor: (articleContent: string) => DataItem): Promise<DataItem> {
return cache.tryGet(link, async () => {
const page = await ofetch(link);
return processor(page);
}) as Promise<DataItem>;
}