Files
RSSHub/lib/routes/grist/utils.ts
T
Nya Candy cce3bdb4fe fix(route): 使用 ofetch() 替换一些 got().json() (#15780)
* chore: some massive adoption from got().json() to ofetch()

Not sure if everything works fine (some may still have problems other than fakeGot & json issues), but this might have some help.

BTW maybe we can start "The Migration" project to update some outdated routes to new format 🤔

* fix: some other issues

* fix: query

* fix: luogu user blog & modb topic

* fix: modb topic response

* fix: query options in freebuf

---------
2024-06-01 01:10:15 +08:00

25 lines
820 B
TypeScript

import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
const getData = (url) => ofetch(url);
const getList = (data) =>
data.map((value) => {
const { id, title, content, date_gmt, modified_gmt, link, parsely, _embedded } = value;
const { image, author } = parsely.meta;
return {
id,
title: title.rendered,
description: content.rendered,
link,
itunes_item_image: image.url,
category: _embedded['wp:term'][0].map((v) => v.name),
author: author.map((v) => v.name).join(', '),
pubDate: timezone(parseDate(date_gmt), 0),
updated: timezone(parseDate(modified_gmt), 0),
};
});
export { getData, getList };