Skip to content

Instantly share code, notes, and snippets.

@tobek
Last active November 12, 2024 18:43
Show Gist options
  • Save tobek/a17fa9101d7e28ddad26 to your computer and use it in GitHub Desktop.
Save tobek/a17fa9101d7e28ddad26 to your computer and use it in GitHub Desktop.
Save images from chrome inspector/dev tools network tab
/* 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 text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
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'));
@raebdam
Copy link

raebdam commented Jun 21, 2023

That worked on my windows10:

& 'C:\path\to\wget.exe' -r -nH --cut-dirs=<N> -P 'C:\Path\to\output' -i 'target_link.txt'

@selmyabed
Copy link

Thanks! saved me some time <3
if that comes to u " 'wget' is not recognized as an internal or external command"
Follow this ==> https://bobbyhadz.com/blog/wget-is-not-recognized-as-internal-or-external-command

@michal-gmail
Copy link

in windows's instead of
"wget -i [that file]"
use following command from PowerShell:

Get-Content [that file] | ForEach-Object { Invoke-WebRequest -Uri $_ -OutFile (Split-Path -Leaf $_) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment