# Build or buy: extracting recipes from TikTok and Instagram yourself

The obvious way to add recipe import from TikTok and Instagram links is to
build it: take the post's caption, give it to a language model, and ask for
the recipe as JSON. On a demo post it works in an afternoon. This guide
lists the problems that show up on real posts, and what the ClipParse API
returns for each, so you can weigh building it against calling an API.

## In short

- **Building it is enough** when the posts you care about have the recipe
  written out in the caption, in one language, and your app only shows the
  recipe as text.
- **It takes more** when the recipe is said out loud or shown on photo
  slides, when users share posts that hold no recipe, when your app scales
  recipes or builds shopping lists from the amounts, or when posts come in
  several languages.
- **ClipParse is an API that covers those cases**: send a TikTok or
  Instagram link, get back the recipe as JSON, or a clear `no_recipe`
  outcome when the post holds none. The free plan has 100 credits a month
  and needs no credit card:
  [get a key](https://clipparse.com/get-free-key).

## The recipe isn't always in the caption

Many creators put only a title and some hashtags in the caption and say the
recipe out loud, or show it on photo slides. A caption-only import tells the
user there's nothing to import from those posts, while the recipe is right
there in the video. Covering them takes a speech-to-text step for videos and
an image-reading step for photo posts, each with its own cost.

ClipParse reads the recipe from the caption, from a photo post's images and,
when the caption falls short, from what is said in the video.

## Posts with no recipe

A model asked for a recipe tends to write one. Give it a restaurant review, a
taste test or a day-in-my-life vlog, and it can return plausible ingredients
the post never mentions. Telling "no recipe here" apart from "a recipe
stated loosely" is the hard part, and a wrong guess either way is visible to
your users: an invented recipe, or a real one turned away.

Compilations are a related case: "5 easy breakfasts" in one post. Merged
into a single recipe, they make no sense.

ClipParse answers both with a `no_recipe` status and a code that says which:

```json
{ "status": "no_recipe", "code": "no_recipe_found" }
```

A compilation returns `multiple_recipes_detected` instead: ClipParse
extracts one recipe per post, so your app can tell the user why rather than
show a merged recipe. Neither outcome uses a credit.

## Quantities and units

Amounts like "200g" are the easy part. The lines that trip up an import are
the ones where the numbers don't mean what they seem: a count and a weight
for the same ingredient, the same amount in two units, a range, or two
ingredients on one line with no amount.

For your app to scale a recipe or build a shopping list, each line needs one
number and one unit from a fixed set, without inventing precision the post
doesn't give. Keep the original line too, for whatever the structured fields
can't express.

Four such lines: "4 chicken thighs (about 600g)", "200g (1 ½ cups) flour",
"2-3 tbsp milk" and "salt and pepper". ClipParse returns them as:

```json
[
  { "name": "chicken thighs", "prep": null, "quantity": 4, "quantityMin": null, "quantityMax": null, "unit": "each", "raw": "4 chicken thighs (about 600g)", "section": null },
  { "name": "flour", "prep": null, "quantity": 200, "quantityMin": null, "quantityMax": null, "unit": "g", "raw": "200g (1 ½ cups) flour", "section": null },
  { "name": "milk", "prep": null, "quantity": 2.5, "quantityMin": 2, "quantityMax": 3, "unit": "tbsp", "raw": "2-3 tbsp milk", "section": null },
  { "name": "salt", "prep": null, "quantity": null, "quantityMin": null, "quantityMax": null, "unit": null, "raw": "salt", "section": null },
  { "name": "pepper", "prep": null, "quantity": null, "quantityMin": null, "quantityMax": null, "unit": null, "raw": "pepper", "section": null }
]
```

`unit` comes from a fixed set, with `each` for an ingredient that is counted
rather than measured and `null` when the post gives no amount. A range keeps
its bounds in `quantityMin` and `quantityMax`, with the midpoint in
`quantity`. `raw` is the ingredient as written in the post.

## Languages

Recipe posts come in every language, and a model's output in one language
isn't proof it handles the others. Amounts are written differently from one
language to the next: "2 EL" in German and "2 c. à s." in French are both
tablespoons, "1,5 kg" uses a decimal comma, and "1 dl" is common in some
countries and unknown in others.

ClipParse returns the recipe in the post's language, with the amounts in the
same fixed units. From a German and a French post:

```json
[
  { "name": "Olivenöl", "prep": null, "quantity": 2, "quantityMin": null, "quantityMax": null, "unit": "tbsp", "raw": "2 EL Olivenöl", "section": null },
  { "name": "Sahne", "prep": null, "quantity": 100, "quantityMin": null, "quantityMax": null, "unit": "ml", "raw": "1 dl Sahne", "section": null },
  { "name": "huile d'olive", "prep": null, "quantity": 2, "quantityMin": null, "quantityMax": null, "unit": "tbsp", "raw": "2 c. à s. d'huile d'olive", "section": null }
]
```

## Keeping it working

Once it ships, the feature needs upkeep. Platform changes break import
pipelines without warning, and even established recipe apps ship regular
fixes for social imports. It also needs a set of test posts to check every
change against, and a budget for the model calls, including those spent on
posts with no recipe.

## Using ClipParse instead

One request with a TikTok or Instagram link returns the recipe with
ingredients, quantities, units, ordered steps, timings and servings, or one
of the outcomes above.

- **Price**: the free plan has 100 credits a month. A recipe uses 1 credit,
  or 4 when it was extracted from what's said in the video. Errors and posts
  with no recipe use none. Paid plans start at $19 a month for 5,000
  credits: see [pricing](https://clipparse.com/pricing).
- **Mobile apps**: the [iOS](/guides/import-recipes-from-tiktok-instagram-ios)
  and [Android](/guides/import-recipes-from-tiktok-instagram-android) SDKs.
- **Anything else**: the API is one HTTP request, from any language or
  framework. The [Python](/guides/extract-recipes-from-tiktok-instagram-python)
  and [Node.js](/guides/extract-recipes-from-tiktok-instagram-node) guides
  show it in code.
- **Every field and outcome**: the [API reference](https://docs.clipparse.com/).

Get a free API key at
[clipparse.com/get-free-key](https://clipparse.com/get-free-key). It takes
seconds and doesn't require a credit card.
