# Command line web scraping: 100 pages in about 3 seconds

Three Spider CLI runs each crawled 100 FastAPI docs pages to markdown in about 3 seconds. Install it, add a key, then pipe the JSON to jq or write a WARC file.

Canonical: https://spider.cloud/blog/spider-cli-web-scraping-at-scale/

Three runs of one Spider CLI command on November 17, 2026 each crawled 100 pages of the FastAPI docs to markdown, in 2.876, 2.964 and 3.018 seconds. Every page came back as a 200.

Each run sent its requests through Spider’s proxy with an API key, from one machine, and printed one JSON object per page with the markdown in its `content` field:

```bash
spider -u https://fastapi.tiangolo.com/ -r --limit 100 --spider-cloud-mode proxy scrape > fastapi.json
```

| Run | Started, UTC | Pages | Status 200 | Seconds |
| --- | ------------ | ----- | ---------- | ------- |
| 1   | 16:10:48     | 100   | 100        | 2.876   |
| 2   | 16:11:02     | 100   | 100        | 2.964   |
| 3   | 16:11:05     | 100   | 100        | 3.018   |

Without a key the CLI crawls from your own machine, and the time depends on your connection.

The rest of this page covers installing spider_cli 2.52.3, saving a key, checking the JSON with `jq` and writing a WARC archive. The [web scraping guide](/web-scraping/) covers the method in general, and [web scraping at scale](/blog/true-cost-of-web-scraping-at-scale/) measures crawl speed and cost per page through the API.

## How do I install the Spider CLI?

With a Rust toolchain on your machine:

```bash
cargo install spider_cli
spider --version
```

On the machine that ran every command on this page, the version check printed:

```plaintext
spider_cli 2.52.3
```

The runs used 2.52.3 with the default features. `cargo install spider_cli` gets the newest release, which crates.io listed as 2.53.9 on November 17, 2026. `cargo install spider_cli --version 2.52.3` gets the one measured here.

On Linux, the CLI’s README lists OpenSSL and pkg-config as build dependencies. The [openssl crate docs](https://docs.rs/openssl/latest/openssl/) give the packages for Debian and Ubuntu:

```bash
sudo apt-get install pkg-config libssl-dev
```

## How do I add an API key?

```bash
spider authenticate --paste
```

The CLI prints `Enter your Spider Cloud API key:`, reads one line, and then prints `API key saved to` with the path, `~/.spider/credentials` in your home directory. You can also pass the key as an argument with `spider authenticate "$SPIDER_CLOUD_API_KEY"`. Later commands read it from that file.

The CLI looks for a key in this order:

1. The `--spider-cloud-key` flag on the command
2. The `SPIDER_CLOUD_API_KEY` environment variable
3. The file that `spider authenticate` saved

It is the same key the Spider API takes. With no key at all, the CLI crawls from your machine on its own.

## What does proxy mode do?

With an API key, `--spider-cloud-mode proxy` sends every request the crawl makes through Spider’s proxy, with the key as the login. The `scrape` and WARC commands on this page both pass it.

I checked that against a test server on my own machine. With the flag and a placeholder key, the CLI sent its request to Spider’s proxy, which refused the key with a 407. The test server logged no request at all, robots.txt included.

Spider bills proxy traffic by bandwidth. The [proxy reference](/docs/api/proxy/) lists the rate for each proxy type, and the [pricing guide](/guides/pricing-and-plans/) explains the bill.

## What does the output look like?

`scrape` prints one JSON object per page. This is the first object from run 1, with the markdown cut short:

```json
{
  "content": "FastAPI - FastAPI\n[\nSkip to content\n](#fastapi)\n...",
  "headers": null,
  "links": null,
  "status_code": 200,
  "url": "https://fastapi.tiangolo.com/"
}
```

The objects follow one another across many lines, and `jq` reads them as a stream. These four lines check a crawl:

```bash
jq -r '.status_code' fastapi.json | sort | uniq -c
jq -s 'length' fastapi.json
jq -r '.url' fastapi.json | head -3
jq -r 'select(.status_code == 200) | .content' fastapi.json | wc -c
```

What they printed for run 1, on a Mac:

```plaintext
 100 200
100
https://fastapi.tiangolo.com/
https://fastapi.tiangolo.com/deployment/server-workers/
https://fastapi.tiangolo.com/reference/templating/
 1929309
```

That is 100 pages, all 200, and 1,929,309 bytes of markdown. `scrape -o` adds each page’s links to its object, and `scrape --output-html` puts the raw HTML in `content` in place of markdown.

## How do I save a crawl as a WARC file?

Add `-W` and a file name. The CLI writes every page it fetches to a WARC 1.1 archive:

```bash
spider -u https://fastapi.tiangolo.com/ -r --limit 5 --spider-cloud-mode proxy -W fastapi.warc crawl -o
```

```plaintext
https://fastapi.tiangolo.com/
https://fastapi.tiangolo.com/zh-hant/
https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/
https://fastapi.tiangolo.com/advanced/custom-response/
https://fastapi.tiangolo.com/pt/
```

It finished in 2.164 seconds. The file came to 896,340 bytes, with one warcinfo record and five response records, one per page. This is how it starts:

```plaintext
WARC/1.1
WARC-Type: warcinfo
WARC-Record-ID: <urn:uuid:...>
WARC-Date: 2026-11-17T16:22:30Z
Content-Type: application/warc-fields
Content-Length: 55

software: spider/2.52.3
format: WARC File Format 1.1

WARC/1.1
WARC-Type: response
WARC-Record-ID: <urn:uuid:...>
WARC-Date: 2026-11-17T16:22:31Z
WARC-Target-URI: https://fastapi.tiangolo.com/
Content-Type: application/http; msgtype=response
Content-Length: 156152

HTTP/1.1 200 OK
```

Each of the five response records holds the status line, the response headers and the page’s HTML, so you can parse the crawl again later without another fetch. The file holds the site’s responses and not your key. I searched it for the key and for an authorization header, and found neither.

## Which flags control the crawl?

All of these go before the subcommand, the way `-r` and `--limit` do in the commands above.

| Flag                                          | What it does                                                                              |
| --------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `--limit 100`                                 | Stop after 100 pages                                                                      |
| `-d 3`                                        | Limit the crawl depth to 3                                                                |
| `-B "*,100,/blog/,10"`                        | Budget by path: 100 pages in all, at most 10 under /blog/                                 |
| `--blacklist-url "/admin,/login"`             | Skip pages that match, as a comma-separated list                                          |
| `-r`                                          | Respect robots.txt. Off unless you pass it.                                               |
| `-D 500`                                      | Wait 500 milliseconds between requests                                                    |
| `-s`                                          | Follow subdomains. Placed after `crawl`, `-s` means `--sync` instead, one page at a time. |
| `-E docs.example.com`                         | Group another domain into the same crawl                                                  |
| `-a "my-crawler/1.0"`                         | Set the User-Agent                                                                        |
| `-p http://user:pass@proxy.example.com:8080`  | Send requests through your own proxy                                                      |
| `--headless`                                  | Render pages in a browser. Needs a build with the `chrome` feature.                       |
| `--chrome-connection-url ws://127.0.0.1:9222` | Connect to a Chrome you already run                                                       |
| `-W site.warc`                                | Write every page to a WARC 1.1 file                                                       |
| `--return-format text`                        | Pick the output format                                                                    |

Of the flags in this table, the runs on this page used `--limit` and `-r`, and the WARC run added `-W`. Every run also passed `-u` and `--spider-cloud-mode proxy`, and the WARC run passed `-o` after `crawl`. The other rows come from the help text of 2.52.3. When a browser renders the page, `--wait-for-selector` makes the CLI wait up to 60 seconds for a CSS selector to appear.

## Which output formats can it write?

| You want                      | Run                                           |
| ----------------------------- | --------------------------------------------- |
| Markdown for each page        | `scrape`, which returns markdown by default   |
| Plain text, CommonMark or XML | `--return-format text`, `commonmark` or `xml` |
| The raw HTML                  | `scrape --output-html`                        |
| Each page’s links as well     | `scrape -o`                                   |
| Only the list of URLs crawled | `crawl -o`                                    |
| HTML files on disk            | `download -t ./pages`                         |
| A WARC archive of the crawl   | `-W site.warc`                                |

## How were the runs done?

All runs were on November 17, 2026, with spider_cli 2.52.3 on one machine. Seconds are the wall time of the whole command, from start to exit. Each of the three scrape runs exited with code 0 and returned 100 objects, all with `status_code` 200, for 100 distinct URLs.

`--limit` caps the count, and the three runs did not return the same 100 pages. 35 URLs were in all three, and 157 distinct URLs came back across the three.

The WARC run started at 16:22:30 UTC with `--limit 5` and exited with code 0. The proxy check ran the same day, against a test server on my own machine.

The CLI is built on [spider](https://github.com/spider-rs/spider), the open source crawler behind the Spider API, under the MIT license and on GitHub since 2018.

## Run it on a site you work with

[Create an API key](https://spider.cloud/api-keys), save it with `spider authenticate --paste`, and run the first command on this page against a site you work with.

## Frequently asked questions

### How do I scrape a website from the command line?

Install the Spider CLI with cargo install spider_cli, save an API key with spider authenticate --paste, then run spider -u with the site's URL, -r, --limit 100, --spider-cloud-mode proxy and the scrape command. Each page prints as a JSON object with the markdown in its content field. On November 17, 2026 that command crawled 100 pages of the FastAPI docs in about 3 seconds, in each of three runs.

### Can the Spider CLI output markdown?

Yes. In version 2.52.3 the scrape command returns markdown by default. The --return-format flag switches to plain text, CommonMark or XML, and scrape --output-html returns the raw HTML instead.

### Can the Spider CLI save a crawl as a WARC file?

Yes. Pass -W with a file name and the CLI writes every page it fetches to a WARC 1.1 archive. A five-page crawl of the FastAPI docs wrote an 896,340-byte file with one warcinfo record and five response records.

### Does the Spider CLI respect robots.txt?

Only when you pass -r, which is off by default. Every run on this page passed it.

### Where does the Spider CLI keep the API key?

spider authenticate saves it to \~/.spider/credentials in your home directory. The CLI checks the --spider-cloud-key flag first, then the SPIDER_CLOUD_API_KEY environment variable, then that file.

### Is the Spider CLI open source?

Yes. It lives in the spider repository on GitHub under the MIT license and ships on crates.io as spider_cli.

## Sources

1. [spider_cli on crates.io, 2.53.9 listed as newest on 2026-11-17](https://crates.io/crates/spider_cli)
2. [spider_cli source and README on GitHub (MIT)](https://github.com/spider-rs/spider/tree/main/spider_cli)
3. [openssl crate docs, Debian and Ubuntu build packages](https://docs.rs/openssl/latest/openssl/)
4. [Spider proxy mode reference](https://spider.cloud/docs/api/proxy/)
5. [Spider pricing guide](https://spider.cloud/guides/pricing-and-plans/)
6. [Spider blog, crawl speed and cost per 1,000 pages, measured 2026-11-17](https://spider.cloud/blog/true-cost-of-web-scraping-at-scale/)
