Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Crawl rendered JavaScript templates from a local server.

Project Description
Command line tool that crawls a local webserver with a headless browser and outputs static html files. Works well with html5validator to validate HTML5 from dynamic content with Javascript.

Run localcrawl --help:

PhantomJS is required. It is pre-installed on TravisCI. On a Mac run brew install PhantomJS.

Example Command

localcrawl --start _build/html/index.html --out _crawled/ --depth 3

Mustache Example

This can be used to convert templated files to HTML files (e.g. for validation with html5validator).

Input:

<html>
<head>
  <title>Mustache Test</title>
</head>
<body>
  <div id="output"></div>

  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.1/mustache.min.js"></script>
  <script>
    var data = {
      item: 'Fork',
      price: function() { return (1.10 * 1.08).toFixed(2); },
    };
    var html = Mustache.render('{{item}}: <b>${{price}}</b>', data);
    document.getElementById('output').innerHTML = html;
  </script>
</body>
</html>

The crawled output includes the output from processing the template (Fork: <b>$1.19</b>):

<html><head>
  <title>Mustache Test</title>
</head>
<body>
  <div id="output">Fork: <b>$1.19</b></div>

  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.1/mustache.min.js"></script>
  <script>
    var data = {
      item: 'Fork',
      price: function() { return (1.10 * 1.08).toFixed(2); },
    };
    var html = Mustache.render('{{item}}: <b>${{price}}</b>', data);
    document.getElementById('output').innerHTML = html;
  </script>


</body></html>

Should play nice with:

JavaScript template engines / JS frameworks:

Static site generators:

Release History

Release History

This version
History Node

0.2.0

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
localcrawl-0.2.0-py2.py3-none-any.whl (7.8 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Jan 14, 2017
localcrawl-0.2.0.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Jan 14, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting