Skip to main content

inscrape

The official Python SDK for Inscrape — the AI-first web scraping API for Instagram, X & beyond.

PyPI Python License

Features

  • 🚀 3-line usage — scrape any site with one function call
  • 📸 Screenshots — full-page or element-targeted PNG capture
  • 📝 Markdown — get clean Markdown instead of raw HTML
  • 📊 Structured JSON — first-class Instagram & X/Twitter profile parsing
  • ⚡ Async support — AsyncInscrape for high-concurrency workflows
  • 🛡️ Smart errors — typed exceptions for rate limits, auth, and quota

Installation

pip install inscrape

For async + HTTP/2 support:

pip install "inscrape[async]"

Quick Start

from inscrape import Inscrape

client = Inscrape("sk_your_token_here")

# Scrape any URL
result = client.scrape("https://example.com")
print(result.content)

# Instagram profile → structured JSON
profile = client.instagram("gkhetawat1")
print(profile["followers"])

# X/Twitter profile → structured JSON
user = client.twitter("elonmusk")
print(user["bio"])

# Full-page screenshot → PNG bytes
png = client.screenshot("https://example.com")
with open("screenshot.png", "wb") as f:
    f.write(png)

# Get Markdown
md = client.markdown("https://example.com")
print(md)

Async Usage

import asyncio
from inscrape import AsyncInscrape

async def main():
    client = AsyncInscrape("sk_your_token_here")

    # All methods are async
    profile = await client.instagram("gkhetawat1")
    print(profile)

    # Concurrent scraping
    results = await asyncio.gather(
        client.scrape("https://example.com"),
        client.scrape("https://httpbin.org/get"),
        client.twitter("naval"),
    )
    for r in results:
        print(r)

    await client.close()

asyncio.run(main())

API Reference

Inscrape(token, base_url="https://api.inscrape.io")

Create a client instance.

client.scrape(url, **kwargs) → ScrapeResult

Full-parameter scrape. Pass any Inscrape API parameter as a keyword argument:

result = client.scrape(
    "https://example.com",
    render=True,
    super_proxy=True,      # maps to super=true
    geo_code="IN",         # maps to geoCode=IN
    wait_selector="div.content",
    block_resources=True,
    timeout=30000,
)
print(result.content)
print(result.status_code)
print(result.credits_used)

client.instagram(username, **kwargs) → dict

Shortcut for Instagram profiles. Automatically sets render=True, super=True, output=json.

client.twitter(username, **kwargs) → dict

Shortcut for X/Twitter profiles. Same smart defaults.

client.screenshot(url, full_page=True, **kwargs) → bytes

Returns decoded PNG bytes.

client.markdown(url, **kwargs) → str

Returns clean Markdown text.

client.estimate(url, **kwargs) → dict

Get estimated credit cost before scraping.

Error Handling

from inscrape import Inscrape, AuthError, RateLimitError, QuotaExhaustedError, InscrapeError

client = Inscrape("sk_xxx")

try:
    result = client.scrape("https://example.com")
except AuthError:
    print("Invalid API token")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except QuotaExhaustedError:
    print("Monthly quota used up — upgrade your plan")
except InscrapeError as e:
    print(f"Scrape failed: {e.message} (code: {e.code})")

License

MIT

Metadata

Release files for inscrape 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inscrape 0.1.0
File Size Uploaded
inscrape-0.1.0.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inscrape 0.1.0
File Interpreter ABI Platform
inscrape-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / inscrape-0.1.0.tar.gz

Download URL inscrape-0.1.0.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
97c06f517679c652385d8cc64750892b9200c685f49501233ba32e1df5e2cf04
BLAKE2b-256 checksum
How to use checksums
75d8472807f47365e05ce7be2ce25f2ff5738535742272c7634ae1a4065eea67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / inscrape-0.1.0-py3-none-any.whl

Download URL inscrape-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b1822a384348a51dd8adbb5596d28dcf39a88fe7f1441ca451a57e8898f66dc
BLAKE2b-256 checksum
How to use checksums
85464625973292517ab4fe0c4b90d8d6c86b1f5bf25a95b4689aec434985b374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page