A decentralized music tracking and discovery platform built on AT Protocol 馃幍 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
at main 17 lines 471 B view raw
1import { ROCKSKY_API_URL } from "../consts"; 2import type { Scrobble } from "../types/scrobble"; 3 4export default async function getScrobble(uri: string) { 5 const url = new URL( 6 `${ROCKSKY_API_URL}/xrpc/app.rocksky.scrobble.getScrobble`, 7 ); 8 url.searchParams.append("uri", uri); 9 const res = await fetch(url); 10 11 if (!res.ok) { 12 return { scrobble: null, ok: res.ok }; 13 } 14 15 const scrobble = (await res.json()) as Scrobble; 16 return { scrobble, ok: res.ok }; 17}