Skip to content

Instantly share code, notes, and snippets.

@tchen
Last active January 8, 2024 07:30
Show Gist options
  • Save tchen/a844c589f3fab497ff930c116aa267e7 to your computer and use it in GitHub Desktop.
Save tchen/a844c589f3fab497ff930c116aa267e7 to your computer and use it in GitHub Desktop.
Extract Images From Zillow Home Views
/**
* Note: First, browser through all the images for the home. Then paste the following snippet into the console.
* Images will be saved to the download directory.
*/
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
$ = jQuery.noConflict();
var img = $('ul.photos li img').map(function(){return $(this).attr("src");});
img.map(function(idx){ $("body").append($("<a class='xyzxyz' href='"+img[idx]+"' download='"+img[idx].split('/')[4]+"' />")); console.log(idx); });
$('.xyzxyz').map(function(){ $(this)[0].click(); });
$('.xyzxyz').remove();
@bryant988
Copy link

bryant988 commented Mar 15, 2020

I made some updates to this:
https://gist.github.com/bryant988/9510cff838d86dcefa3b9ea3835b8552

Note, it works specifically for houses that are for sale since it renders different.

Copy link

ghost commented Mar 15, 2020 via email

@GGLionCross
Copy link

GGLionCross commented Jan 17, 2022

Had to adjust the script, but this worked for me:

/**
 *  Note: First, browser through all the images for the home.
 *  Then paste the following snippet into the console.
 *  Images will be saved to the download directory.
 */
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";

document.getElementsByTagName('head')[0].appendChild(jq);

// ... give time for script to load, then type.
$ = jQuery.noConflict();
function download(url, filename) {
  fetch(url)
    .then(response => response.blob())
    .then(blob => {
      const link = document.createElement("a");
      link.href = URL.createObjectURL(blob);
      link.download = filename;
      link.click();
  })
  .catch(console.error);
}
var img = $('ul.media-stream li img').map(function(){return $(this).attr("src");});
img.map(function(idx){ download(img[idx], idx+".jpg"); console.log(idx); });

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