← 返回 Skills 市场
adarshvmore

Instagram Collector

作者 Adarsh More · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
290
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install instagram-collector
功能描述
Collects Instagram profile stats including followers, posts, engagement rate, posting frequency, avg likes/comments, and top hashtags via Apify scraper.
使用说明 (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 looks like a legitimate Apify-based Instagram scraper, but the SKILL.md requires an APIFY_API_TOKEN while the registry metadata does not declare any required environment variables—this mismatch is the main red flag. Before installing: 1) Confirm the publisher/source (no homepage provided) and prefer a vetted source. 2) Require the author to declare APIFY_API_TOKEN in the skill metadata (so the platform can enforce secret handling). 3) Store APIFY_API_TOKEN securely (least privilege) and ensure it can be revoked. 4) Verify the implementation of apifyService.scrapeInstagramProfile (or run in a sandbox) so you know exactly what network calls and data are transmitted. 5) Ensure logs do not leak handles or tokens (sanitize error logs). 6) Be aware that each run may incur Apify costs and rate limits; test with a low-volume account first. If the publisher cannot explain or correct the missing credential declaration, treat the skill as untrusted.
功能分析
Type: OpenClaw Skill Name: instagram-collector Version: 1.0.0 The skill is a standard data collector designed to fetch Instagram profile metrics via the Apify API. It follows safe implementation patterns, including structured error handling, timeout management, and clear data mapping logic (SKILL.md). No evidence of malicious intent, data exfiltration, or prompt injection was found.
能力评估
Purpose & Capability
The SKILL.md clearly depends on the Apify Instagram Profile Scraper and therefore needs an APIFY_API_TOKEN. The registry metadata lists no required environment variables or primary credential, which is inconsistent with the stated purpose and should be corrected.
Instruction Scope
Instructions describe calling the Apify actor, polling for completion, fetching dataset results, mapping fields, and extracting hashtags — all consistent with collecting Instagram metrics. The instructions do not ask for unrelated system files or other secrets. They do log errors (including the handle) which could expose user-provided handles in logs if not sanitized.
Install Mechanism
This is an instruction-only skill with no install script or code files, so nothing is written to disk during install. That minimizes install-time risk.
Credentials
SKILL.md explicitly requires an APIFY_API_TOKEN (sensitive credential) but the skill metadata lists zero required env vars and no primary credential. Lack of declared credential is a mismatch and should be fixed. Aside from Apify, no other credentials are requested.
Persistence & Privilege
always is false and the skill does not request persistent or system-wide privileges. Autonomous invocation is allowed (platform default) but there is no evidence the skill modifies other skill configs or requires permanent presence.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install instagram-collector
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /instagram-collector 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the Instagram Collector Skill. - Collects Instagram profile data for a given handle using Apify's Instagram Profile Scraper. - Extracts follower count, engagement rate, posting frequency, and top 10 hashtags from recent posts. - Designed for seamless integration and error handling within the Marketing Audit Pipeline. - Always returns structured data, with an error flag for any failure scenarios instead of throwing exceptions.
元数据
Slug instagram-collector
版本 1.0.0
许可证
累计安装 1
当前安装数 0
历史版本数 1
常见问题

Instagram Collector 是什么?

Collects Instagram profile stats including followers, posts, engagement rate, posting frequency, avg likes/comments, and top hashtags via Apify scraper. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 290 次。

如何安装 Instagram Collector?

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

Instagram Collector 是免费的吗?

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

Instagram Collector 支持哪些平台?

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

谁开发了 Instagram Collector?

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

💬 留言讨论