POST/instagram
Streams post metadata from an Instagram profile as NDJSON.
Request Body
urequiredUsername, @username, or full profile URLig_session_idrequiredInstagram sessionid cookie valuelimitoptionalMax posts to return (Recommended max: 50)Example Request
POST /instagram
Content-Type: application/json
{
"u": "natgeo",
"ig_session_id": "49476777829%3A...",
"limit": 20
}Consuming the Stream
const res = await fetch('/instagram', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ u: 'natgeo', ig_session_id: '...', 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));
}
}Error Responses
400Missing u or session ID / invalid username401Missing ig_session_id in body404Profile not found, private, or has no public posts500Failed to initialize yt-dlp502Failed to reach Instagram