Skip to content

Instantly share code, notes, and snippets.

@rkachowski
Created October 3, 2015 12:23
Show Gist options
  • Select an option

  • Save rkachowski/b0140a2e5585caeb4b66 to your computer and use it in GitHub Desktop.

Select an option

Save rkachowski/b0140a2e5585caeb4b66 to your computer and use it in GitHub Desktop.
jquery script to grab all the large preview photos from http://marathonfoto.com/
var images = $('img[src$=".jpg"]');
var frame_ids = $.map(images, function(el, index){ return $(el).attr("frameid")});
var urls = $.map(frame_ids, function(el, index){ return "/Ajax/Zoom/?frameid=" + el});
var responses = [];
$.each(urls, function(index, el){ resp = $.get(el, null, function(data){responses.push(data)}) });
function getImagesUrlsFromServerResponses(responses)
{
var regex = /.*Vertical.*'(.*)'/;
var encoded = $.map(responses, function(element,index){
var match = regex.exec(element);
if(match != null){return match[1]}
});
var decoded = $.map(encoded, function(element, index){
return $("<div/>").html(element).text();
});
return decoded;
}
function downloadURI(uri, name)
{
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
}
function downloadAll()
{
image_urls = getImagesUrlsFromServerResponses(responses);
$.each(image_urls, function(index, el){
downloadURI(el, "photo"+index);
});
}
@pinares

pinares commented Oct 8, 2015

Copy link
Copy Markdown

Hi, nice job!
how should I run the script? how can I pass the args? I'm not very good with js and html.
Regards.

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