UNPKG

rsshub

Version:
37 lines (35 loc) 1.65 kB
import { t as config } from "./config-C37vj7VH.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; //#region lib/routes/bsky/utils.ts /** * docs: https://atproto.com/lexicons/app-bsky */ const resolveHandle = (handle, tryGet) => tryGet(`bsky:${handle}`, async () => { const { data } = await got_default("https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle", { searchParams: { handle } }); return data.did; }); const getProfile = (did, tryGet) => tryGet(`bsky:profile:${did}`, async () => { const { data } = await got_default("https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile", { searchParams: { actor: did } }); return data; }); const getAuthorFeed = (did, filter, tryGet) => tryGet(`bsky:authorFeed:${did}:${filter}`, async () => { const { data } = await got_default("https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed", { searchParams: { actor: did, filter, limit: 30 } }); return data; }, config.cache.routeExpire, false); const getFeed = (uri, tryGet) => tryGet(`bsky:feed:${uri}`, async () => { const { data } = await got_default("https://public.api.bsky.app/xrpc/app.bsky.feed.getFeed", { searchParams: { feed: uri, limit: 30 } }); return data; }, config.cache.routeExpire, false); const getFeedGenerator = (uri, tryGet) => tryGet(`bsky:feedGenerator:${uri}`, async () => { const { data } = await got_default("https://public.api.bsky.app/xrpc/app.bsky.feed.getFeedGenerator", { searchParams: { feed: uri } }); return data; }, config.cache.routeExpire, false); //#endregion export { resolveHandle as a, getProfile as i, getFeed as n, getFeedGenerator as r, getAuthorFeed as t };