tik-down
API
GET

/instagram

Streams all post entries from an Instagram profile as NDJSON using yt-dlp. Requires a valid session cookie configured on the server.

Query Parameters

urequiredInstagram username, @username, or full profile URL
limitoptionalMax number of posts to return. Omit to get all.

Example Requests

GET /instagram?u=natgeo
GET /instagram?u=@natgeo
GET /instagram?u=https://www.instagram.com/natgeo/
GET /instagram?u=natgeo&limit=20

Response

Returns application/x-ndjson. Each line is a self-contained JSON object representing one post, emitted as yt-dlp discovers it.

{"id":"ABC123","title":"Caption text","webpage_url":"https://www.instagram.com/p/ABC123/","thumbnail":"https://...","duration":15,...}
...

Error Responses

400Missing ?u= parameter or invalid username/URL
404Profile not found, private, or has no public posts
500Session cookie not configured on server
502Failed to reach Instagram

Consuming the Stream

const res = await fetch('/instagram?u=natgeo&limit=20');
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buf = '';

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  buf += decoder.decode(value, { stream: true });
  const lines = buf.split('\n');
  buf = lines.pop();
  for (const line of lines) {
    if (line) console.log(JSON.parse(line));
  }
}