Skip to content

Instantly share code, notes, and snippets.

@booc0mtaco
Forked from tobek/get-image-urls.js
Last active July 16, 2018 05:45
Show Gist options
  • Save booc0mtaco/63fc3558054469685513feb188e9b014 to your computer and use it in GitHub Desktop.
Save booc0mtaco/63fc3558054469685513feb188e9b014 to your computer and use it in GitHub Desktop.
Save images from chrome inspector network tab
/* right click on an entry in the network log, select Copy All as Har
* type in console: x = [paste]
* next, paste the following JS code into the console
* copy the output, paste into a file (or `cat > image-list.txt`, paste output, and hit ^D on a new line)
* then wget -i [that file]
* `mime` can be full or partial matches, e.g., "image/" or "image/png"
* TODO: regexp on mime param.
*/
(function(logObj, mime) {
var results = [];
logObj.log.entries.forEach(function (entry) {
if (mime && entry.response.content.mimeType.indexOf(mime) === -1) return;
results.push(entry.request.url);
});
console.log(results.join('\n'));
})(x, 'image/jpeg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment