Async generator that automatically follows next_href pagination, yielding each page's collection array.
next_href
collection
Function that fetches the first page of results
Function that fetches subsequent pages given a next_href URL
An async generator yielding arrays of items (one per page)
import { paginate, searchTracks, scFetchUrl } from 'soundcloud-api-ts';const pages = paginate( () => searchTracks(token, 'lofi'), (url) => scFetchUrl(url, token),);for await (const page of pages) { console.log(`Got ${page.length} tracks`);} Copy
import { paginate, searchTracks, scFetchUrl } from 'soundcloud-api-ts';const pages = paginate( () => searchTracks(token, 'lofi'), (url) => scFetchUrl(url, token),);for await (const page of pages) { console.log(`Got ${page.length} tracks`);}
https://developers.soundcloud.com/docs/api/explorer/open-api
Async generator that automatically follows
next_hrefpagination, yielding each page'scollectionarray.