DEV Community

API Serpent
API Serpent

Posted on

Needed YouTube + Instagram Data in One Script. Here's the Cleanest Way to Do It in 2026.

Getting YouTube and Instagram data officially requires two separate OAuth setups, two approval processes, and two quota systems. Here's how to do it with one API key and 10 lines of code instead.

You're building a creator research tool. Or a social media audit dashboard. Or an AI agent that researches brands.

You need YouTube channel stats and Instagram profile data for the same person or brand. Together. In one workflow.

The official path:

YouTube: Google Cloud project + credentials + 100 searches/day quota + quota extension form + weeks of waiting
Instagram: Facebook Developer account + Meta app review (2-8 weeks) + OAuth setup + token refresh logic

That's two completely separate authentication systems, two approval processes, and two quota systems to manage before writing a single line of product code.

There's a faster way.

One API Key for Both

import requests

BASE_URL = "https://apiserpent.com/api/social"
HEADERS = {"X-API-Key": "YOUR_SERPENT_KEY"}

def research_creator(youtube_handle: str, instagram_username: str) -> dict:
    """Get full creator profile across YouTube + Instagram in parallel."""

    # YouTube channel stats
    yt = requests.get(f"{BASE_URL}/youtube/channel",
        params={"id": youtube_handle}, headers=HEADERS).json()

    # Instagram profile stats
    ig = requests.get(f"{BASE_URL}/instagram/profile",
        params={"username": instagram_username}, headers=HEADERS).json()

    return {
        "name": yt.get("title"),
        "youtube": {
            "subscribers": yt.get("subscribers"),
            "total_views": yt.get("totalViews"),
            "video_count": yt.get("videoCount")
        },
        "instagram": {
            "followers": ig.get("followers"),
            "engagement_rate": ig.get("engagementRate"),
            "avg_likes": ig.get("avgLikes")
        },
        "cross_platform_reach": yt.get("subscribers", 0) + ig.get("followers", 0)
    }


# Research a creator across both platforms
creator = research_creator("@mkbhd", "mkbhd")
print(f"YouTube subscribers: {creator['youtube']['subscribers']:,}")
print(f"Instagram followers: {creator['instagram']['followers']:,}")
print(f"Instagram engagement: {creator['instagram']['engagement_rate']}%")
print(f"Total combined reach: {creator['cross_platform_reach']:,}")
Enter fullscreen mode Exit fullscreen mode

No Google Cloud. No Meta app review. No OAuth on either side.

Scaling to a bulk research workflow

import concurrent.futures

creators = [
    {"yt": "@mkbhd",      "ig": "mkbhd"},
    {"yt": "@linustechtips", "ig": "linustech"},
    {"yt": "@mrwhosetheboss", "ig": "mrwhosetheboss"},
]

def process_creator(c):
    return research_creator(c["yt"], c["ig"])

# Run all in parallel
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
    results = list(executor.map(process_creator, creators))

# Sort by Instagram engagement rate
ranked = sorted(results, key=lambda x: x["instagram"]["engagement_rate"], reverse=True)
for r in ranked:
    print(f"{r['name']}: {r['instagram']['engagement_rate']}% engagement, "
          f"{r['instagram']['followers']:,} IG followers")
Enter fullscreen mode Exit fullscreen mode

Check 50 creators across both platforms in a few seconds. No quota walls. No token expiry errors mid-run.

What it costs

At Scale tier ($500 deposit, drawn down as you use it):

  • YouTube: $0.01 per 1,000 calls
  • Instagram: $0.58 per 1,000 profile checks

Checking 50 creators (50 YouTube + 50 Instagram calls): $0.03 total.

Monthly cost for a tool checking 10,000 creators per month: $5.90.

Real use cases this unlocks

  • Influencer discovery platforms — score creators by YouTube growth + Instagram engagement in one pass
  • Agency reporting tools — automated weekly snapshots of client and competitor social performance
  • AI research agents — function call that returns complete social profile for any creator or brand
  • Brand monitoring — track competitor brand presence across both platforms automatically

Limitations

  • Instagram: public accounts only
  • YouTube: read-only (no uploading or account management)
  • Not a publishing API — this is for data retrieval

Top comments (0)