1.0.0-pre • Published 5 years ago

minispider v1.0.0-pre

Weekly downloads
1
License
GPL-3.0
Repository
-
Last release
5 years ago

minispider

Software that will scrape any static-like website and produce an equivalent static site.

Features:

  • The website can contain interactive JavaScript, SVG... Pages are loaded in Chrome to discover resources needed by the website as well as future pages to scan.
  • Experimental support for websites that use service workers or app cache.
  • The website can load dynamic resources as long as they're hosted outside (i.e. social widgets).
  • Works with decent-sized sites. Request and response headers of all the resources are all kept into RAM, but bodies are always saved progressively to the disk.
  • Supports exclusions (don't save a part of the website, either because it's dynamic or we don't care).
  • Saved website doesn't need to be a domain, it can be a subfolder. Or you can select resources by format. Or by prefix.
  • Can also save multiple domains, including wildcards such as saving anything at https://*.alba.sh/*.
  • As an intermediary step, this also produces a full-blown scan of the website, including resource headers, types, error page, which page references which resources, what the final rendered HTML is, etc. It can also report places where resources are loaded by absolute URL instead of relative URL, resources that are loaded through redirect, etc.

Limitations:

  • The website itself must be static or static-like. That is, requests must always return the same body, and must not return errors other than 404. Response can not vary depending on the query string, or on the headers.
  • Since this works like a web spider (scanning pages and resources recursively, starting from one or more roots) it may not discover all of them. You have to solve this manually by providing more roots or improving the scanning process yourself.

Install

This uses headless Chrome to do the scraping. By default, the version of Chrome bundled with puppeteer is used, so all you have to do is:

npm install

If you'd like to use a different Chrome executable than the bundled one, it can be changed through the configuration.

Usage

TODO