Skip to main content

You’re scrolling TikTok at 9pm and a guy makes a skillet chicken dish that looks great. You tap share, send it to FeastMark, and wait for the recipe. Then you notice the caption says “recipe in video 🔥” and nothing else. The ingredients, the amounts and the steps are all spoken. None of it is written down anywhere a scraper can find.

That’s the problem this post is about. FeastMark is my iOS app for saving recipes from links. It has a small Node backend, feastmark-api, that turns a URL into a clean recipe. Most of the time that’s easy. Recipe sites publish structured data, and the server just reads it. Short-form video is the hard case, so I added a step that pulls the video’s transcript through Supadata and reads the recipe from what the cook actually said.

Here’s how it works, with the real code.

Cheapest first

The server tries a list of steps in order, and the first one that finds a recipe wins:

  1. A cache of recipes it already extracted.
  2. Structured data the app already pulled from the page on the phone.
  3. Page HTML the app already rendered on the phone.
  4. A server fetch of the page or the video post.
  5. Structured data from whatever that fetch returned.
  6. The transcript, and then AI.

Steps 1 through 5 are free and exact. Only step 6 costs money, and it’s the only one that can drop or invent a step. So it runs last, only after everything else came up empty.

Getting the transcript

Supadata has one endpoint that takes a video URL and returns the transcript. It works the same for TikTok, Instagram, YouTube and Facebook, so I only had to write this once:

const SUPADATA_BASE = 'https://api.supadata.ai/v1/transcript';
const MIN_TRANSCRIPT_CHARS = 40;

export async function fetchTranscript(url, {
  apiKey = process.env.SUPADATA_API_KEY,
  timeoutMs = 45_000,
  pollIntervalMs = 3_000,
} = {}) {
  if (!apiKey) return null;
  const deadline = Date.now() + timeoutMs;
  const headers = { 'x-api-key': apiKey };
  try {
    const res = await fetch(
      `${SUPADATA_BASE}?url=${encodeURIComponent(url)}&text=true`,
      { headers }
    );
    if (!res.ok) return null;
    let data = await res.json();

    // Some requests come back as a job to poll instead of a transcript.
    if (data && data.jobId) {
      for (;;) {
        if (Date.now() >= deadline) return null;
        await new Promise((r) => setTimeout(r, pollIntervalMs));
        const poll = await fetch(`${SUPADATA_BASE}/${data.jobId}`, { headers });
        if (!poll.ok) return null;
        data = await poll.json();
        if (data && typeof data.content === 'string') break;
        if (data && (data.status === 'failed' || data.error)) return null;
      }
    }

    const text = typeof data?.content === 'string' ? data.content.trim() : '';
    return text.length >= MIN_TRANSCRIPT_CHARS ? text : null;
  } catch {
    return null;
  }
}

A few decisions in there are worth explaining.

text=true asks for plain text instead of timestamped chunks. The AI step doesn’t care when a word was said, only what was said.

The job polling. Some requests come back with a jobId instead of a transcript. The function checks every three seconds and gives up after 45. A user staring at a spinner won’t wait much longer than that.

Every failure returns null. No key, a bad response, a timeout, a failed job, a transcript too short to hold a recipe: all of them return null and never throw. That’s on purpose. This step can only add successes. If Supadata is down, FeastMark behaves exactly like it did before I added it.

The 40-character floor. A video with only music, or a one-line “link in bio”, gives back a tiny transcript. Sending that to the AI step is just paying to hear “no recipe here.”

Handing it to the AI

The transcript doesn’t replace what the scraper found. It gets added to it, so the AI sees the caption and the spoken words together:

export function appendTranscript(rawContent, transcript) {
  let obj;
  try { obj = JSON.parse(rawContent); } catch { obj = {}; }
  obj.bodyText = `${obj.bodyText || ''}\n\nVIDEO TRANSCRIPT:\n${transcript}`.trim();
  return JSON.stringify(obj);
}

The label matters more than it looks. Captions often have the ingredient list and the video has the steps, or the other way around. Marking which text came from the audio helps the model put the two together.

Testing without spending money

Every Supadata call costs a credit, so the test suite never makes one. fetchTranscript takes its fetch function as a parameter (left out above to keep the code short), and the tests pass in a fake that returns canned responses: a direct transcript, a job that finishes, a job that fails, a timeout. The whole suite runs with no API keys at all.

What I’d tell you if you’re building this

Put the paid step last and make it fail quietly. Then you can add it, remove it, or run out of credits without breaking the rest of your app.

The flip side: quiet failure is quiet. My free credits ran out in mid-October, and the transcript step returned nothing for nine days before I noticed. Nothing crashed, so nothing told me. Now I’m adding a running count of transcript successes and failures to the server’s health page, plus a daily check that emails me when they start failing.

FeastMark is free on the App Store.

Want to try Supadata? This is my referral link: supadata.ai/r/YB239JC6

Raul C. Peña

Raul C. Peña

Senior Software Engineer at Dell Technologies. Air Force veteran, 20 years in Texas real estate, self-taught coder. Works on DevOps and HashiCorp Vault at enterprise scale.

Big Beard Apps logo Builds iOS apps at Big Beard Apps