← 返回 Skills 市场
adarshvmore

Instagram Collector Adarsh

作者 Adarsh More · GitHub ↗ · v1.0.1
cross-platform ⚠ suspicious
317
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install instagram-collector-adarsh
功能描述
Collects Instagram profile metrics for a handle using Apify, returning followers, posts, engagement rate, posting frequency, avg likes/comments, and top hash...
使用说明 (SKILL.md)

Instagram Collector Skill

Purpose

Collects Instagram profile data for a given handle using the Apify Instagram Profile Scraper. Extracts follower count, engagement metrics, posting frequency, and top hashtags. This collector feeds into the Marketing Audit Pipeline to populate the Instagram Performance section of the final report.

Input Schema

// Function signature
collectInstagram(handle: string): Promise\x3CInstagramData>

// The handle parameter is the Instagram username without the @ symbol.
// Example: "gymshark" (not "@gymshark")

Output Schema

interface InstagramData {
 followers: number;
 posts: number;
 engagementRate: number; // Calculated: (avgLikes + avgComments) / followers * 100
 postingFrequency: string; // e.g. "1.2 posts/day", "3 posts/week", "unknown"
 avgLikes: number;
 avgComments: number;
 topHashtags: string[]; // Up to 10 most-used hashtags from recent posts
 error?: string; // Present only when collector fails
}

API Dependencies

  • API Name: Apify Instagram Profile Scraper
  • Actor ID: apify~instagram-profile-scraper
  • Endpoint: https://api.apify.com/v2/acts/apify~instagram-profile-scraper/runs
  • Auth: APIFY_API_TOKEN environment variable
  • Cost estimate: ~$0.005 per run on Apify free/paid tier
  • Rate limits: Depends on Apify plan; free tier allows limited concurrent runs

Implementation Pattern

Data Flow

  1. Receive handle string from the pipeline
  2. Call apifyService.scrapeInstagramProfile(handle) which starts an Apify actor run
  3. Apify runs asynchronously -- the service polls for completion (timeout: 60s)
  4. Fetch the actor's dataset results once complete
  5. Map the raw Apify response to the InstagramData interface

Engagement Rate Calculation

engagementRate = ((avgLikes + avgComments) / followers) * 100;
  • If followers is 0, set engagementRate to 0 to avoid division by zero
  • Engagement rate is expressed as a percentage (e.g., 3.5 means 3.5%)

Posting Frequency Calculation

  • Analyze timestamps from the last 30 posts returned by Apify
  • Calculate the time span between the oldest and newest post
  • Divide the number of posts by the number of days in that span
  • Format as a human-readable string:
  • = 1 post/day: "X.X posts/day"

  • \x3C 1 post/day but >= 1/week: "X posts/week"
  • \x3C 1 post/week: "X posts/month"
  • If no timestamp data available: "unknown"

Top Hashtags Extraction

  • Iterate through captions of recent posts
  • Extract all #hashtag tokens using regex: /#(\w+)/g
  • Count frequency of each hashtag
  • Return the top 10 most frequently used

Apify Response Mapping

Key fields from Apify's raw output:

  • followersCount -> followers
  • postsCount -> posts
  • latestPosts[].likesCount -> used for avgLikes
  • latestPosts[].commentsCount -> used for avgComments
  • latestPosts[].caption -> used for hashtag extraction
  • latestPosts[].timestamp -> used for posting frequency

Error Handling

  • Entire function wrapped in try/catch
  • On failure, return EMPTY_INSTAGRAM_DATA with error field set:
return { ...EMPTY_INSTAGRAM_DATA, error: 'Instagram data unavailable: \x3Creason>' };
  • Never throw -- always return a valid InstagramData object
  • Log errors with Winston logger including handle and error details:
logger.error('Instagram collector failed', { handle, err });
  • Common failure scenarios:
  • Apify token invalid or expired
  • Actor run timeout (profile too large or Apify overloaded)
  • Profile is private or does not exist
  • Rate limit exceeded on Apify

Example Usage

import { collectInstagram } from '../collectors/instagramCollector';

// Successful collection
const data = await collectInstagram('gymshark');
// Returns:
// {
// followers: 6800000,
// posts: 4520,
// engagementRate: 1.85,
// postingFrequency: "1.3 posts/day",
// avgLikes: 120000,
// avgComments: 5800,
// topHashtags: ["gymshark", "fitness", "gym", "workout", "fitnessmotivation", ...],
// }

// Failed collection (graceful degradation)
const failedData = await collectInstagram('nonexistent_handle_12345');
// Returns:
// {
// followers: 0,
// posts: 0,
// engagementRate: 0,
// postingFrequency: "unknown",
// avgLikes: 0,
// avgComments: 0,
// topHashtags: [],
// error: "Instagram data unavailable: Profile not found"
// }

Notes

  • The collector depends on apifyService.ts for the actual API communication. The collector handles only data mapping and calculations.
  • Apify actor runs are asynchronous. The service layer handles polling. If the run does not complete within 60 seconds, it should be treated as a timeout error.
  • This collector is independently testable. In tests, mock apifyService.scrapeInstagramProfile to return fixture data.
  • Instagram data can be stale -- Apify scrapes public data which may be cached. This is acceptable for audit purposes.
  • The EMPTY_INSTAGRAM_DATA constant is defined in src/types/audit.types.ts and should be imported for fallback returns.
  • This collector must never block the pipeline. Even a complete failure returns valid typed data with an error flag, allowing other collectors to proceed.
安全使用建议
This skill appears to do what it says (use Apify to scrape public Instagram profiles), but there are a few things to check before installing: - Ensure you provide an APIFY_API_TOKEN to the runtime (SKILL.md requires it) — the registry metadata incorrectly declares no env vars. Don't paste your token into logs or shared output. - Because no code files are bundled, verify the actual apifyService implementation the agent will call: confirm it uses the official Apify API endpoint, handles the actor run/dataset retrieval correctly, and does not call unexpected external endpoints. - Review error logging to make sure sensitive values (tokens, internal URIs) are not included in structured logs; consider redaction. - Confirm the referenced actor ID (apify~instagram-profile-scraper) is the expected Apify actor and that you accept the estimated per-run cost and rate limits. If you cannot inspect or control the apifyService implementation and token handling, avoid installing or run it in a restricted/test environment first.
功能分析
Type: OpenClaw Skill Name: instagram-collector-adarsh Version: 1.0.1 The skill bundle defines a standard integration for collecting Instagram profile metrics using the Apify Instagram Profile Scraper. The SKILL.md file provides clear, functional instructions for an AI agent to process data, calculate engagement rates, and extract hashtags using regex (/#(\w+)/g). It follows best practices for error handling and uses the APIFY_API_TOKEN environment variable as expected for its stated purpose. No evidence of malicious intent, data exfiltration, or prompt injection was found.
能力评估
Purpose & Capability
The skill's name and SKILL.md consistently describe an Instagram profile collector that uses Apify; requesting an Apify actor run is coherent with that purpose. However, the registry metadata declares no required environment variables while the SKILL.md explicitly requires an APIFY_API_TOKEN for authentication — this mismatch is unexpected and should be corrected/clarified.
Instruction Scope
SKILL.md stays within scope: it describes calling the Apify actor, polling for completion, mapping fields, calculating metrics, and returning structured data. It references apifyService.ts, EMPTY_INSTAGRAM_DATA, and a Winston logger, but none of those implementation files are included in the skill bundle — so the runtime behavior depends on out-of-band code. The instructions also reference the APIFY_API_TOKEN environment variable (not listed in the declared requirements). There are no instructions to read unrelated system files or to send data to endpoints other than Apify.
Install Mechanism
This is an instruction-only skill with no install spec and no bundled code, so nothing will be downloaded or written by the skill itself. That reduces install-time risk, but also means the actual API-calling code lives elsewhere (the skill assumes an existing apifyService implementation).
Credentials
The SKILL.md requires an APIFY_API_TOKEN to call Apify, which is a proportionate credential for this purpose. However, the skill metadata lists no required env vars — an inconsistency that could lead to misconfiguration or accidental token exposure. Also, error logging is specified with Winston and includes handle and err details; ensure logs cannot accidentally contain sensitive token data or other secrets.
Persistence & Privilege
The skill does not request persistent presence (always:false) and does not declare any privileged system access or config-path requirements. It also does not attempt to modify other skills or global agent configuration in the instructions.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install instagram-collector-adarsh
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /instagram-collector-adarsh 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Added metadata file `_meta.json` for skill indexing and discovery. - No functional changes to the collector logic.
v1.0.0
Initial release of the Instagram Collector Skill. - Collects Instagram profile metrics (followers, posts, avg likes/comments, top hashtags) for a given handle using the Apify Instagram Profile Scraper. - Calculates engagement rate and posting frequency from recent posts. - Handles errors gracefully, always returning a well-typed result with error details if applicable. - Designed to feed data into the Marketing Audit Pipeline's Instagram Performance section. - Includes detailed API dependency and usage documentation.
元数据
Slug instagram-collector-adarsh
版本 1.0.1
许可证
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Instagram Collector Adarsh 是什么?

Collects Instagram profile metrics for a handle using Apify, returning followers, posts, engagement rate, posting frequency, avg likes/comments, and top hash... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 317 次。

如何安装 Instagram Collector Adarsh?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install instagram-collector-adarsh」即可一键安装,无需额外配置。

Instagram Collector Adarsh 是免费的吗?

是的,Instagram Collector Adarsh 完全免费(开源免费),可自由下载、安装和使用。

Instagram Collector Adarsh 支持哪些平台?

Instagram Collector Adarsh 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Instagram Collector Adarsh?

由 Adarsh More(@adarshvmore)开发并维护,当前版本 v1.0.1。

💬 留言讨论