Skip to main content

Official Python client for the MetaScrape API — extract metadata from any URL in one call

Project description

metascrape

Official Python client for the MetaScrape API -- extract metadata from any URL in one call.

Get Open Graph tags, Twitter Cards, favicons, canonical URLs, and more with a single request. Zero dependencies. Works with Python 3.8+.

Install

pip install metascrape

Quick Start

from metascrape import MetaScrape

ms = MetaScrape("your-api-key")

meta = ms.extract("https://example.com")
print(meta["title"])       # "Example Domain"
print(meta["og"]["image"]) # "https://example.com/image.png"
print(meta["description"]) # "An example website"

Getting an API Key

  1. Sign up at metascrape.shanecode.org
  2. Your API key is returned on login

Or use the SDK directly:

from metascrape import MetaScrape

# Create an account
MetaScrape.signup("you@example.com", "your-password")

# Login to get your API key
result = MetaScrape.login("you@example.com", "your-password")
print(result["api_key"])  # Use this for all authenticated requests

API Reference

MetaScrape(api_key, base_url=None)

Create a client instance.

Parameter Type Default Description
api_key str required Your MetaScrape API key
base_url str https://api.shanecode.org API base URL

ms.extract(url)

Extract metadata from a URL. Returns the metadata dict directly (envelope is unwrapped).

meta = ms.extract("https://github.com")

Returns:

Field Type Description
title str Page title
description str Meta description
og dict Open Graph tags (title, description, image, type, site_name)
twitter dict Twitter Card tags (card, title, description, image, site)
favicon str Favicon URL
canonical_url str Canonical URL
language str Page language
structured_data list JSON-LD structured data
response_time_ms int Extraction time in milliseconds

ms.usage()

Get your current month's API usage.

usage = ms.usage()
print(f"{usage['used']} / {usage['limit']} requests used")

Returns: {"plan": str, "used": int, "limit": int, "remaining": int}

MetaScrape.signup(email, password, base_url=None)

Class method. Create a new account. No API key required.

MetaScrape.signup("you@example.com", "secure-password")

MetaScrape.login(email, password, base_url=None)

Class method. Login and retrieve your API key. No API key required.

result = MetaScrape.login("you@example.com", "secure-password")
api_key = result["api_key"]

Error Handling

The client raises MetaScrapeError for non-2xx responses:

from metascrape import MetaScrape, MetaScrapeError

ms = MetaScrape("your-api-key")

try:
    meta = ms.extract("https://example.com")
except MetaScrapeError as e:
    print(e.status_code)  # 401, 429, etc.
    print(e.message)      # "invalid API key", "rate limit exceeded", etc.

Pricing

Plan Requests/month Price
Free 100 $0
Hobby 1,000 $9/mo
Growth 10,000 $29/mo
Business 100,000 $79/mo

Start free at metascrape.shanecode.org.

Links

License

MIT -- see LICENSE


Built by ShaneCode -- https://shanecode.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metascrape-1.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metascrape-1.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file metascrape-1.0.1.tar.gz.

File metadata

  • Download URL: metascrape-1.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for metascrape-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1d93ca372d4062dd18ed332fa0e6b8bc0aa4282f71c81be23fc83d098654764c
MD5 e404f9180acba372a11146a8399523d3
BLAKE2b-256 17bf7d0b69b7c8961951bcca949ebb12d8d00ff655a6b47782a0546ecd319acc

See more details on using hashes here.

File details

Details for the file metascrape-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: metascrape-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for metascrape-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 995a223a27e8a9482af5b3b08dddf7191a97039065ea7b1a818f708e286461a9
MD5 97f06ed2eb535bebabef26c374610993
BLAKE2b-256 309c28e7504ef04e18a48c4b2beba094d6aaf266812bc8194a98d81b2591fa26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page