Skip to content

Instantly share code, notes, and snippets.

@chkob
Forked from tobek/get-image-urls.js
Last active November 2, 2019 12:47
Show Gist options
  • Select an option

  • Save chkob/be398bb668a4c83280bec50adc05a834 to your computer and use it in GitHub Desktop.

Select an option

Save chkob/be398bb668a4c83280bec50adc05a834 to your computer and use it in GitHub Desktop.

Revisions

  1. chkob revised this gist Nov 2, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions get-image-urls.js
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,6 @@ var imageUrls = [];
    har.log.entries.forEach(function (entry) {
    // This step will filter out all URLs except images. If you just want e.g. just jpg's then check mimeType against "image/jpeg", etc.
    if (entry.response.content.mimeType.indexOf("image/") !== 0) return;
    imageUrls.push(entry.request.url);
    imageUrls.push('\'' + entry.request.url + '\'');
    });
    console.log(imageUrls.join('\n'));
    console.log(imageUrls.join(',\n'));
  2. @tobek tobek renamed this gist Oct 10, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @tobek tobek revised this gist Oct 10, 2019. 1 changed file with 15 additions and 12 deletions.
    27 changes: 15 additions & 12 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,17 @@
    /* right click on an entry in the network log, select Copy All as Har
    * type in console: x = [paste]
    /* open up chrome dev tools (Menu > More tools > Developer tools)
    * go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
    * right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
    * open up JS console and enter: var har = [paste]
    * (pasting could take a while if there's a lot of requests)
    * paste the following JS code into the console
    * copy the output, paste into a file
    * then wget -i [that file]
    * copy the output, paste into a text file
    * open up a terminal in same directory as text file, then: wget -i [that file]
    */
    (function(logObj, mime) {
    var results = [];
    logObj.log.entries.forEach(function (entry) {
    if (mime && entry.response.content.mimeType !== mime) return;
    results.push(entry.request.url);
    });
    console.log(results.join('\n'));
    })(x, 'image/jpeg');

    var imageUrls = [];
    har.log.entries.forEach(function (entry) {
    // This step will filter out all URLs except images. If you just want e.g. just jpg's then check mimeType against "image/jpeg", etc.
    if (entry.response.content.mimeType.indexOf("image/") !== 0) return;
    imageUrls.push(entry.request.url);
    });
    console.log(imageUrls.join('\n'));
  4. @tobek tobek revised this gist Oct 10, 2019. No changes.
  5. @tobek tobek created this gist Sep 3, 2014.
    14 changes: 14 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    /* right click on an entry in the network log, select Copy All as Har
    * type in console: x = [paste]
    * paste the following JS code into the console
    * copy the output, paste into a file
    * then wget -i [that file]
    */
    (function(logObj, mime) {
    var results = [];
    logObj.log.entries.forEach(function (entry) {
    if (mime && entry.response.content.mimeType !== mime) return;
    results.push(entry.request.url);
    });
    console.log(results.join('\n'));
    })(x, 'image/jpeg');