Official Python client for the ScrapeNest API — web scraping, search, AI answers, screenshots, PDFs, Google Maps reviews, and transcription.
Project description
scrapenest
Official Python client for the ScrapeNest API — web scraping, search, AI answers, screenshots, PDFs, Google Maps reviews, gas prices, and audio transcription.
- Docs: https://scrapenest.dev/docs
- Get an API key: https://scrapenest.dev
Install
pip install scrapenest
Requires Python 3.9+.
Quick start
from scrapenest import Client
client = Client("sn_your_key_here")
result = client.search("python web scraping", num_results=5)
for r in result.results:
print(r.title, r.url)
Every method returns a typed dataclass. Pass include_usage=True (where supported) to get a usage block with the credits charged.
Search
# SERP results. depth = "fast" | "balanced" | "thorough"
hits = client.search("openai news", depth="balanced", num_results=10)
# Search + fetch & clean the top pages
deep = client.search_deep("what is rust lang", fetch_top=3)
for page in deep.pages:
print(page.url, len(page.text or ""))
# Cited answer synthesized from live sources
answer = client.search_answer("who wrote the odyssey", max_sources=3)
print(answer.answer)
for c in answer.citations:
print(c.index, c.url)
Scrape a page
page = client.scrape_url(
"https://example.com",
render="auto", # auto | direct | browser | stealth
extract=True,
return_markdown=True,
)
print(page.title)
print(page.markdown[:500])
# AI extraction
data = client.scrape_url("https://example.com/product", ai_query="Return the product name and price")
print(data.ai_extract)
Screenshots & PDF
shot = client.screenshot("https://example.com", full_page=True, format="png")
with open("page.png", "wb") as f:
import base64
f.write(base64.b64decode(shot.image_base64))
doc = client.pdf("https://example.com", format="A4", landscape=False)
with open("page.pdf", "wb") as f:
import base64
f.write(base64.b64decode(doc.pdf_base64))
Google Maps reviews
Pass a place URL or a 0x…:0x… FID. Use place_url to bypass FID-built URLs for tricky listings.
res = client.maps_reviews("https://www.google.com/maps/place/...", max_reviews=50, sort="newest")
print(res.name, res.rating, res.review_count)
for rev in res.reviews:
print(rev.author_name, rev.rating, rev.text)
# Large pulls run as async jobs
run = client.maps_reviews_async("0x6b12ae665e892fdd:0x3133f8d75a1ac251", max_reviews=2000)
final = client.wait_for_run(run.run_id)
print(f"{len(final.result['reviews'])} reviews fetched")
# Need to stop a long job early? client.cancel_run(run.run_id)
Gas prices
gas = client.gas_prices("Los Angeles, CA", grade="regular", limit=10)
for s in gas.stations:
print(s.brand, s.address, s.price)
if gas.region_stats:
print(gas.region_stats.region, gas.region_stats.average_price)
Translate & transcribe
tr = client.translate("Hello, how are you?", "es")
print(tr.translated)
audio = client.audio_transcript("https://www.youtube.com/watch?v=...")
print(audio.text)
Async client
import asyncio
from scrapenest import AsyncClient
async def main():
async with AsyncClient("sn_your_key_here") as client:
result = await client.search("python web scraping")
print(result.results[0].title)
asyncio.run(main())
AsyncClient exposes the same methods as Client.
Error handling
from scrapenest import RateLimitError, AuthenticationError, PaymentRequiredError
try:
result = client.search("test")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except PaymentRequiredError:
print("Out of credits")
except AuthenticationError:
print("Invalid API key")
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapenest-0.5.0.tar.gz.
File metadata
- Download URL: scrapenest-0.5.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e247cd784e31f18d14deff301f925f33449602dbf863d02df9cd44b8ab28f16d
|
|
| MD5 |
4e211c6a83e76f28d6f9b0d22b0dfecf
|
|
| BLAKE2b-256 |
8ed5cb3bb379e9c8537dd48b833f7439ce505deb9b64ea9839038a5eea4f64e3
|
File details
Details for the file scrapenest-0.5.0-py3-none-any.whl.
File metadata
- Download URL: scrapenest-0.5.0-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
829866b6900799d94cf3cc90f1353fd91c9521d2915fc4fd0a935488d045f1c1
|
|
| MD5 |
f45a5c337387ae641b440ae787e3eb9b
|
|
| BLAKE2b-256 |
309be52c2504e45f6363d2ab82c714aac3c601e8dba01e3acf46ed0dbf5752f7
|