On this page5 sections
Your app takes a playlist or channel link and has to turn it into every video inside it: a course importer that takes a YouTube playlist, a clip tool that follows a creator's channel, a podcast archive that takes a feed. The user pastes one link; your backend needs each item as a file (or a transcript) in your own storage.
That is two jobs, and both are harder from a server than from your laptop.
A playlist is two problems, not one
First you have to expand the playlist into a list of video links. A watch link with &list=..., a youtube.com/playlist?list=... URL, a @channel/videos page: each one stands for many videos, and you can't download it as a single thing.
Then you have to download each video. Code that pulls one video fine on your machine starts returning 403s and bot checks once it runs from AWS, GCP, Fly or a serverless function, and a playlist of a few hundred items means a few hundred chances for one private, deleted or region-blocked video to abort the whole run.
So the real work isn't one download. It's listing the items, then fetching each one reliably, without holding a web request open while a 40-minute video downloads.
List the playlist's items
POST /collection lists the items of a playlist, channel, profile, album or podcast feed, a page at a time, without downloading anything. It runs as a job: you get a jobId, then poll GET /collection/status or pass a webhookUrl.
const listPage = async (url, cursor) => {
const res = await fetch('https://api.importly.io/collection', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.IMPORTLY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ url, cursor, limit: 200 }),
})
const body = await res.json()
if (!body.success) throw new Error(`${body.code}: ${body.error}`)
// poll GET /collection/status?id=body.data.jobId until status === 'completed'
return pollUntilDone(body.data.jobId)
}A completed page gives you the collection's title and item count, plus up to 200 items. Each item comes with a url ready for the next step, its title and duration, and an isLive flag:
{
"collection": { "title": "Coding Challenges", "itemCount": 246 },
"items": [
{ "url": "https://www.youtube.com/watch?v=17WoOqgXsRM", "title": "Starfield Simulation", "duration": 834, "isLive": false },
{ "url": "https://www.youtube.com/watch?v=LG8ZK-rRkXo", "title": "Menger Sponge Fractal", "duration": 841, "isLive": false }
],
"nextCursor": "eyJ2IjoxLCJoIjoi…"
}Send the same URL back with the previous page's nextCursor as cursor to walk the rest; nextCursor is null on the last page. A page of up to 200 items costs $0.003, so a 1,000-video playlist lists for $0.015.
Import each video to your own storage
Now you have a list of links. Send each one to POST /import with a webhookUrl so you aren't holding a connection open per video. Importly downloads the file and delivers it where your app can use it, and posts to your webhook when each job finishes.
for (const item of items) {
if (item.isLive) continue // a live stream isn't downloadable until it ends
await fetch('https://api.importly.io/import', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.IMPORTLY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: item.url,
webhookUrl: 'https://example.com/webhooks/import',
includeTranscript: true, // drop this if you only want the file
}),
})
}Each import runs on its own, so one private or region-blocked video fails its own job and refunds its own charge instead of stopping the others. Store each item's id and you can rerun the listing later and import only the videos you don't already have.
Channels, profiles and podcast feeds work the same way
A channel is just a longer list. Point /collection at youtube.com/@name for its videos, or its /shorts or /streams link for those. The same call lists TikTok profiles, SoundCloud sets, Bandcamp albums, Vimeo showcases and podcast RSS feeds, each item's url ready for /import or /transcribe.
Two things it won't expand: a YouTube Mix (list=RD...), which is generated fresh for each viewer, and X or Instagram profiles, which only show their posts to signed-in visitors. Both come back as a clear code, not charged.
What it costs
Listing is $0.003 a page of up to 200 items. The videos you then import or transcribe are billed as usual, per the pricing page, and there's no plan or subscription: your balance is just credit you spend. You can start free, no card required.
The point is that you get the files, not just a list of links. If your app needs every video in a playlist as something it can store, play, clip or search, this turns a brittle scraping-and-stitching job that breaks on your servers into two API calls.