Python and JavaScript SDKs
The Python and JavaScript clients, with the OpenAPI spec for any other language.
SnoopScan has an official client for Python and one for JavaScript and TypeScript. Both are MIT licensed and wrap the same REST endpoints you can call yourself.
Read and follow https://snoopscan.com/agent-onboarding/SKILL.md into any agent, then sign in and press Approve.
Python
The package is snoopscan on PyPI. It needs Python 3.10 or newer, and there is an async client, AsyncSnoopScan, with the same methods.
pip install snoopscan
from snoopscan import SnoopScansnoop = SnoopScan() # the key comes from SNOOPSCAN_API_KEYpage = snoop.scrape("https://example.com/")print(page.markdown)for link in snoop.map("https://example.com/", limit=100): print(link["url"])pages = snoop.crawl_and_wait("https://example.com/", limit=50)print(len(pages), "pages")
JavaScript and TypeScript
The package is snoopscan on npm. It needs Node 18 or newer and has no dependencies. It is built on fetch, so it also runs in the browser, and it ships its own types.
npm install snoopscan
import { SnoopScan } from 'snoopscan';const snoop = new SnoopScan(); // the key comes from SNOOPSCAN_API_KEYconst page = await snoop.scrape('https://example.com/');console.log(page.markdown);for (const link of await snoop.map('https://example.com/', { limit: 100 })) { console.log(link);}const pages = await snoop.crawlAndWait('https://example.com/', { limit: 50 });console.log(pages.length, 'pages');
Your key
Both clients read the key from the SNOOPSCAN_API_KEY environment variable, and a key you pass in code wins. Create one under API keys. See Authentication for how keys and scopes work.
Coverage
- Scrape, crawl (with
crawl_and_waitto follow a job for you), map, search and batch scrape. - Extract with a JSON schema or a named template such as
product,articleorjobPosting. - Products and posts for a store's catalog and a blog's articles.
- Company and domain lookups, plus the domain report, screen and snapshots on the hosted API.
- Brand and tech, for a company's brand and the technologies a page runs.
- Monitors, and parse for a file or a URL.
Tools that are not in a client yet, such as Google SERP, Social and Research, are plain REST calls. Their pages show the request in Python, Node and cURL.
Errors and retries
Every failure raises a SnoopScanError carrying the API's error code, so your code can tell a blocked page from a bad request. A rate-limited request is retried for you, and so is a failed read that is safe to repeat. A call that starts work, such as a crawl or a monitor, is never retried after a server error, because a repeat could start it twice. Both clients retry up to two times by default and you can turn it off. The codes are on the Errors page.
Any other language
The API is described by an OpenAPI document, generated from the requests the engine validates, so it matches what the API accepts. Point a code generator at it, or read it yourself:
https://api.snoopscan.com/openapi.json
The open-source core of the engine is on GitHub.