pip install spidra and your API key in SPIDRA_API_KEY. The example uses the Python tutorial.
1. Crawl the section as Markdown
Start at the section you want; the crawl stays under that path. With notransform_instruction or schema, each page’s data is its Markdown and no AI runs:
2. Split pages into chunks, without the menus
A crawl returns the whole page, including the site’s navigation. Splitting at headings and skipping sections that are mostly short bullet links removes the menus. Here’s the whole script:chunks.jsonl (text shortened):
3. Embed and store
Each line has the text and its source, so you can embedtext with any embedding model and store url and title as metadata, which lets your app cite the page an answer came from. Re-run the script on a schedule to keep the knowledge base current, or watch the pages with alertOn: "page" to know when they change.
Bigger sites
- Raise
max_pagesup to your plan’s limit (100 on Free, up to 10,000 on Pro). The Python SDK’scrawl()reads every page, even past the 100 thatGET /crawl/{jobId}holds. - Fence the crawl with
include_paths=["/3/tutorial/*"]orexclude_paths=["/3/whatsnew/*"]when the section links elsewhere. - Pick pages first with Map, then batch scrape them with
extract_content_only=True, which removes menus, headers and footers for you.
Good to know
- The splitter here is deliberately simple: a
#comment at the start of a line inside a code block is also treated as a heading. For production, use a Markdown-aware splitter. - Pages the crawl read only to find others aren’t returned or charged. If a page you expected is missing, read the crawl report.

