Crawl rendered JavaScript templates from a local server.
Project description
Run localcrawl --help:
You will need PhantomJS. On a Mac:
brew install PhantomJS
PhantomJS is pre-installed on TravisCI.
Example Run 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:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
localcrawl-0.1.2.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for localcrawl-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6035e1dba10414da197227e5717968d568896c86d4ed5c88f2e6f9a1a9cd430d |
|
MD5 | 6a9286500739a6c07959423f9a6c8a71 |
|
BLAKE2b-256 | ef270022dac88115eeecfc22a21f11364849d012488d6bcbc27db231ef521486 |