← Back to Skills Marketplace
adarshvmore

Instagram Collector Adarsh

by Adarsh More · GitHub ↗ · v1.0.1
cross-platform ⚠ suspicious
317
Downloads
0
Stars
1
Active Installs
2
Versions
Install in OpenClaw
/install instagram-collector-adarsh
Description
Collects Instagram profile metrics for a handle using Apify, returning followers, posts, engagement rate, posting frequency, avg likes/comments, and top hash...
README (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.
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install instagram-collector-adarsh
  3. After installation, invoke the skill by name or use /instagram-collector-adarsh
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug instagram-collector-adarsh
Version 1.0.1
License
All-time Installs 1
Active Installs 1
Total Versions 2
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 317 downloads so far.

How do I install Instagram Collector Adarsh?

Run "/install instagram-collector-adarsh" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Instagram Collector Adarsh free?

Yes, Instagram Collector Adarsh is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Instagram Collector Adarsh support?

Instagram Collector Adarsh is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Instagram Collector Adarsh?

It is built and maintained by Adarsh More (@adarshvmore); the current version is v1.0.1.

💬 Comments