Read who said each line
quality=premium reads a transcript the account owns for 0 credits. Otherwise the GET starts one, using credits from the account's plan, then its on-demand budget, and answers 202 pending with the job. State failed means the last attempt failed, and retry=true starts it again.
const url = "https://api.arcmira.com/v1/transcripts/aHhB3sjGjkI?quality=premium&start=60&end=120"
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.ARCMIRA_API_KEY}` },
})
const transcript = await res.json()
if (transcript.state === "pending") {
console.log("pending", transcript.job.status_url, transcript.job.next_poll_seconds)
} else if (transcript.state === "failed") {
console.log("failed", transcript.last_attempt.error)
} else if (!res.ok) {
throw new Error(transcript.error?.code ?? `HTTP ${res.status}`)
} else {
const names = new Map<number, string>()
for (const s of transcript.speakers ?? []) names.set(s.id, s.name)
for (const line of transcript.lines) {
console.log(`[${line.start}s] ${names.get(line.speaker) ?? "Unidentified speaker"}: ${line.text}`)
}
}
Search what was said across videos
One topic per call. Each result carries the spoken text, a timestamped watch link and the publish date. 4 credits per result past the first 5 of a request.
import json, os, urllib.parse, urllib.request
query = urllib.parse.urlencode({"q": "datacenter power demand", "limit": 3})
request = urllib.request.Request(
f"https://api.arcmira.com/v1/search?{query}",
headers={"Authorization": f"Bearer {os.environ['ARCMIRA_API_KEY']}"},
)
with urllib.request.urlopen(request) as response:
for chunk in json.load(response)["chunks"]:
print(chunk["cite_line"] or chunk["watch_url"])
print(chunk["text"][:240], "\n")
The Premium response for the TypeScript request, trimmed to two lines. A repeat read of a transcript the account owns uses 0 credits.
{
"video": {
"id": "aHhB3sjGjkI",
"title": "Agents Building Agents - Alfonso Graziano, Nearform",
"channel_name": "AI Engineer",
"duration_seconds": 1814,
"watch_url": "https://www.youtube.com/watch?v=aHhB3sjGjkI"
},
"quality": "premium",
"source": "arcmira_premium",
"lines": [
{ "start": 60.54, "end": 67.42, "speaker": 0, "index": 14,
"text": "So today we will see how we are building and improving iteratively AI agents." },
{ "start": 67.84, "end": 71.77, "speaker": 0, "index": 15,
"text": "And of course, as you may guess, how can we do that, right?" }
],
"speakers": [{ "id": 0, "name": "Speaker 1", "entity_id": null, "confidence": null }],
"revision": "r1hk7or3.jx73u4",
"rows_billed": 0
}