Scrape Everything
Recipes for agentsMenu

Recipes for agents

Metrics your agent can compute from fields the API already returns, and how to keep responses small enough for a model's context.

Engagement rate, views and posting frequency

One list call gives you enough for all three. instagram.reels and x.posts return the follower count next to the items, so no second call is needed.

JavaScript
// data = the "data" object of an instagram.reels, instagram.photos or x.posts response
function metrics(data) {
  const items = data.reels ?? data.posts ?? [];
  const followers = data.follower_count;
  const median = (xs) => {
    const s = xs.filter((x) => typeof x === "number").sort((a, b) => a - b);
    if (!s.length) return null;
    const m = Math.floor(s.length / 2);
    return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
  };

  // Engagement rate per post: interactions / followers x 100. Skip posts whose counts are hidden.
  const rates = items
    .filter((p) => !p.like_and_view_counts_disabled && typeof p.like_count === "number")
    .map((p) => {
      const interactions =
        p.like_count + (p.comment_count ?? 0) + (p.reply_count ?? 0) + (p.retweet_count ?? 0) + (p.quote_count ?? 0);
      return followers ? (interactions / followers) * 100 : null;
    });

  // Posts per week: Instagram taken_at is Unix seconds, X created_at is a date string
  const times = items
    .map((p) => (typeof p.taken_at === "number" ? p.taken_at * 1000 : Date.parse(p.created_at)))
    .filter((t) => Number.isFinite(t))
    .sort((a, b) => a - b);
  const weeks = times.length > 1 ? (times.at(-1) - times[0]) / (7 * 24 * 3600 * 1000) : null;

  return {
    posts: items.length,
    median_engagement_rate: median(rates),
    median_views: median(items.map((p) => p.view_count)),
    posts_per_week: weeks ? (times.length - 1) / weeks : null,
  };
}
EndpointInteractionsViewsTime
instagram.reelslike_count, comment_countview_counttaken_at (Unix seconds, approximate)
instagram.photoslike_count, comment_countnonetaken_at (Unix seconds)
x.postslike_count, reply_count, retweet_count, quote_countview_countcreated_at (X date string)
tiktok.postsnone (use tiktok.video per video)play_countnone (use tiktok.video)
youtube.videosnone (use youtube.video per video)view_count (approximate)published_text (relative, e.g. 2 days ago)
telegram.postsnoneview_count (approximate)posted_at (ISO 8601)

The Agent Skills include a ready-made post-metrics.mjs script that computes these from a saved response.

Keeping responses small

Response size depends mostly on how many items a list returns and how long their text is (captions, comments, transcripts). Single-object endpoints, such as a profile or one post, stay small. Lists grow with limit, so ask for only what the task needs.

Terminal
curl -s -X POST https://api.scrapeeverything.com/v1/instagram/reels \
  -H "Authorization: Bearer $SCRAPEEVERYTHING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"username": "nasa", "limit": 12}' | wc -c
Token counts depend on the model's tokenizer. Measure with your model's token counter rather than relying on a fixed ratio.