apify-influencer-brand-collabs

作者: apify

通过串联Apify Actors发现Instagram品牌与创作者的合作关系。当用户询问某品牌与谁合作、某创作者曾与哪些品牌进行付费合作时使用…

npx skills add https://github.com/apify/awesome-skills --skill apify-influencer-brand-collabs

Influencer–Brand Collaborations

Surface Instagram branded-content partnerships by chaining four Apify Actors against Meta's Ad Library. Distilled from the production influencer-brand-collabs mini-tool.

When to use

  • "Who has Nike paid to promote them this quarter?"
  • "What brands does @bellahadid do sponsored posts for?"
  • Auditing an account's branded-content history
  • Building a competitor's influencer roster

Don't use for: organic mentions or tags (use a hashtag/mentions scraper), TikTok or YouTube collabs (different platforms), generic competitor ads (query Meta Ad Library directly).

Inputs to gather

  1. Instagram handle or URL@adidas or https://www.instagram.com/adidas/
  2. Lookback window — days; default 90
  3. Enrichment toggles (each adds cost + time):
    • Content insights — likes, comments, views per collab
    • Profile enrichment — followers, bio, verified status of the other side

Direction (brand vs creator) is detected empirically. Do not ask.

The pipeline

#ActorPurposeRequired
1apify/instagram-profile-scraperResolve the target's Facebook fbid
2apify/brand-collaboration-scraperPull branded-content posts from Meta's Ad Library
3apify/instagram-post-scraper + apify/instagram-reel-scraperEngagement metricsoptional
4apify/instagram-profile-scraper (again)Enrich the result-side partnersoptional

Call each via mcp__claude_ai_Apify__call-actor. Use mcp__claude_ai_Apify__fetch-actor-details first if you've never run one of these and want the exact input schema.

Step 1 — Resolve the target

// actor: apify/instagram-profile-scraper
{ "usernames": ["adidas"] }

Grab fbid from the first item. No fbid → can't query Ad Library → stop and tell the user. Most common cause: private account.

Step 2 — Build the Meta Ad Library URL

https://www.facebook.com/ads/library/branded_content/?id={fbid}&query={username}&target=instagram&start_date={YYYY-MM-DD}&end_date={YYYY-MM-DD}

Date range = the lookback window (default 90 days, ending today).

Step 3 — Fetch collaborations

// actor: apify/brand-collaboration-scraper
{ "startUrls": ["<ad library url>"], "resultsLimit": 10 }

Schema is fixed: every item has creator (always the influencer side) and brandPartners[0] (always the brand side). Do not try to infer direction from these fields.

Step 4 — Detect direction empirically

Count how often the target username appears on each side of the results:

  • target appears more on creator side → target is the influencer; results are the brands
  • target appears more on brandPartners side → target is the brand; results are the creators

⚠️ Do not use isBusinessAccount to infer this. It's unreliable — e.g. @fifaworldcup is a business account but appears as the creator of its own branded content.

Step 5 — (optional) Content metrics

Split collab URLs by type:

  • /reel/... → reel scraper
  • /p/... or /tv/... → post scraper
// actor: apify/instagram-post-scraper
{ "username": ["<post urls>"], "resultsLimit": 1, "dataDetailLevel": "basicData" }

// actor: apify/instagram-reel-scraper
{ "username": ["<reel urls>"], "resultsLimit": 1 }

Match back to collabs via shortcode in the URL: /(p|reel|tv)/([A-Za-z0-9_-]+).

Engagement formula: likesCount + commentsCount + (videoViewCount ?? videoPlayCount ?? 0).

Run the two scrapers in parallel — they're independent.

Step 6 — (optional) Enrich the result side

Collect unique usernames from the side that is not the target. Then:

// actor: apify/instagram-profile-scraper
{ "usernames": [<unique result-side usernames>] }

Only enrich the side the user actually cares about. The input handle is already known.

What to present

After aggregation, surface:

  • Headline counts: total collabs, unique partners, total engagement (if metrics enriched)
  • Top 5 collabs by engagement — only meaningful when content insights were toggled on
  • Content-type mix: Post vs Reel; Reels usually dominate engagement
  • Weekly timeline across the date range — spikes reveal campaign launches
  • Per-partner card (when profiles enriched): handle, full name, followers, verified, category, collabs in this run, avg engagement

For who-questions, the partner list alone is enough. Metrics only matter for which-was-best-questions.

URL parsing

Strip Instagram's _u/ and _n/ deep-link prefixes before extracting the handle:

/instagram\.com\/(?:_u\/|_n\/)?([A-Za-z0-9_.]+)/i

These slugs are not usernames — skip them: explore, reels, stories, direct, accounts, about, p, reel, tv, tags, locations, _u, _n.

Pitfalls

  • Target is private → profile scraper returns no fbid. Bail early with a clear message.
  • No results → try in order: widen the date range, double-check the handle (strip _u/), confirm the account actually runs branded content. Meta only indexes ads they've classified as branded content.
  • Engagement is all zeros → user skipped content enrichment. Offer to re-run with it on.
  • Direction looks wrong in the output → re-check the empirical count. Don't trust isBusinessAccount.
  • Brand collabs with no metrics are still answer-shaped for who questions — don't gate the whole flow on enrichment.

Cost & time

Full 4-actor run: ~3–5 minutes, a few cents of Apify compute. Order of magnitude:

EnrichmentActors runApprox time
None21–2 min
+ Content3–42–4 min
+ Profiles+1+30–60 s

If the user just needs a partner list, skip both toggles.

Reference implementation

Production route this skill was distilled from: mini-tools-main/src/app/api/tools/influencer-brand-collabs/route.ts — full transformation logic, error handling, and slimmed display shapes for each scraper's output.

来自 apify 的更多技能

bug-triage
apify
对 apify/apify-mcp-server 上的开放 bug 问题进行分类。分析、草拟回复、获取批准、发布。
official
dig
apify
用于在Apify MCP服务器上探索、规划和指定工作的灵活技能。请勿编辑源文件——此技能仅用于理解和规划。
official
apify-financial-news
apify
发现并提取追踪的投资组合公司在33个经过验证的一级来源(彭博社、路透社、金融时报、华尔街日报、IntelliNews、捷克通讯社、波兰通讯社、保加利亚通讯社……)中的财经新闻。
official
apify-actor-development
apify
创建、调试和部署用于网页抓取、自动化及数据处理的无服务器云程序。支持JavaScript、TypeScript和Python模板,集成Crawlee、Playwright和Cheerio库,用于HTTP和基于浏览器的爬取。包含通过apify run进行的本地测试(使用隔离存储)、输入/输出的模式验证,以及通过apify push部署到Apify平台。需要Apify CLI认证,并在.actor/actor.json中强制包含generatedBy元数据以用于AI...
official
apify-actorization
apify
将现有项目转换为无服务器Apify Actors,支持语言特定的SDK集成。支持JavaScript/TypeScript(使用Actor.init() / Actor.exit())、Python(异步上下文管理器)以及通过CLI包装器的任何语言。提供结构化工作流:使用apify init搭建脚手架,应用SDK封装,配置输入/输出模式,通过apify run进行本地测试,然后使用apify push进行部署。包含输入和输出模式验证、Docker容器化以及可选的按事件付费...
official
apify-generate-output-schema
apify
通过分析Apify Actor的源代码生成输出模式(dataset_schema.json、output_schema.json、key_value_store_schema.json)。在以下情况下使用…
official
apify-ultimate-scraper
apify
自动化网页抓取工具,为55多个平台(包括Instagram、TikTok、YouTube、Facebook、Google Maps等)选择最优Actor。涵盖8大主流平台的55多个预配置Actor,并提供针对特定用例的选择指导(潜在客户生成、网红发现、品牌监控、竞争对手分析、趋势研究)。支持三种输出格式:快速聊天显示、CSV导出或JSON导出,可自定义结果数量限制。包含多Actor工作流模式,适用于复杂...
official
apify-audience-analysis
apify
从Facebook、Instagram、YouTube和TikTok提取受众人口统计、参与模式和行为数据。支持18+个专业Actor,涵盖所有四个平台的粉丝人口统计、参与指标、评论和资料分析。提供三种输出格式:快速聊天显示、CSV导出或JSON导出,用于下游分析。需要Apify令牌和mcpc CLI工具;使用动态模式获取来调整输入以适应每个Actor的要求。包括结构化...
official