Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think using PhantomJS will be the easiest. No need for node.js.</p> <p>You can combine <code>examples/scandir.js</code> and <code>examples/phantomwebintro.js</code> to get what you want.</p> <pre><code>var system = require('system'); var fs = require('fs'); if (system.args.length !== 2) { console.log("Usage: phantomjs scandir.js DIRECTORY_TO_SCAN"); phantom.exit(1); } function scanDirectory(path, cb) { if (fs.exists(path) &amp;&amp; fs.isFile(path)) { cb(path); } else if (fs.isDirectory(path)) { fs.list(path).forEach(function (e) { if (e !== "." &amp;&amp; e !== "..") { scanDirectory(path + '/' + e, cb); } }); } } function parsePage(path) { var page = require('webpage').create(); page.open(path, function(status) { if (status === "success") { page.includeJs("http://code.jquery.com/jquery-latest.js", function() { var images = page.evaluate(function() { var images = []; $('img').each(function() { images.push({ src: $(this).attr('src'), pos: $(this).position() }); }); return images; }); console.log(images); }); } }); } scanDirectory(system.args[1], parsePage); </code></pre> <p>This script (<code>phantomjs img.js kittens</code>) will scan the directory for files, load every file in that directory (and subdirectories, you can modify this behavior in <code>scanDirectory</code>) and find all <code>&lt;img&gt;</code> tags on that page and return an array with their <code>src</code> attributes and <code>.position()</code>.</p> <p>Took me about 20 minutes to get this to work, so I think this is the easiest way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload