981 stable releases

new 2.21.27 Dec 14, 2024
2.13.84 Nov 30, 2024
1.99.37 Aug 14, 2024
1.99.13 Jul 31, 2024
1.10.7 Jul 27, 2022

#1278 in Web programming

Download history 2997/week @ 2024-08-24 1413/week @ 2024-08-31 1432/week @ 2024-09-07 1080/week @ 2024-09-14 2032/week @ 2024-09-21 2307/week @ 2024-09-28 4563/week @ 2024-10-05 2252/week @ 2024-10-12 4370/week @ 2024-10-19 1765/week @ 2024-10-26 3719/week @ 2024-11-02 1005/week @ 2024-11-09 617/week @ 2024-11-16 7407/week @ 2024-11-23 4173/week @ 2024-11-30 3354/week @ 2024-12-07

15,719 downloads per month

MIT license

720KB
14K SLoC

Spider CLI

crate version

A fast command line spider or crawler.

Dependencies

On Linux

  • OpenSSL 1.0.1, 1.0.2, 1.1.0, or 1.1.1

Note: You need to have pkg-config installed otherwise openssl will not be recognized by cargo.

# On Ubuntu:
apt install pkg-config

Usage

The CLI is a binary so do not add it to your Cargo.toml file.

# without headless
cargo install spider_cli
# with headless
cargo install -F chrome spider_cli
# with smart mode defaults to HTTP and Headless when needed
cargo install -F smart spider_cli
# with full resources not just web pages
cargo install -F full_resources spider_cli

Cli

The following can also be ran via command line to run the crawler. If you need loging pass in the -v flag.

spider --url https://choosealicense.com crawl --output-links

Crawl and output all links visited to a file.

spider --url https://choosealicense.com crawl -o > spider_choosealicense.json

Download all html to local destination. Use the option -t to pass in the target destination folder.

spider --url https://choosealicense.com download -t _temp_spider_downloads

Set a crawl budget and only crawl one domain.

spider --url https://choosealicense.com --budget "*,1" crawl -o

Set a crawl budget and only allow 10 pages matching the /blog/ path and limit all pages to 100.

spider --url https://choosealicense.com --budget "*,100,/blog/,10" crawl -o
The fastest web crawler CLI written in Rust.

Usage: spider [OPTIONS] --url <DOMAIN> [COMMAND]

Commands:
  crawl     Crawl the website extracting links
  scrape    Scrape the website extracting html and links
  download  Download html markup to destination
  help      Print this message or the help of the given subcommand(s)

Options:
  -d, --url <DOMAIN>                Domain to crawl
  -r, --respect-robots-txt             Respect robots.txt file
  -s, --subdomains                     Allow sub-domain crawling
  -t, --tld                            Allow all tlds for domain
  -v, --verbose                        Print page visited on standard output
  -D, --delay <DELAY>                  Polite crawling delay in milli seconds
  -b, --blacklist-url <BLACKLIST_URL>  Comma seperated string list of pages to not crawl or regex with feature enabled
  -u, --user-agent <USER_AGENT>        User-Agent
  -B, --budget <BUDGET>                Crawl Budget
  -h, --help                           Print help
  -V, --version                        Print version

All features are available except the Website struct on_link_find_callback configuration option.

Dependencies

~19–37MB
~671K SLoC