Skip to content

Instantly share code, notes, and snippets.

@insekticid
Last active October 22, 2023 22:23
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save insekticid/29199354b5085f61dd39fd32f8c4e2a9 to your computer and use it in GitHub Desktop.
Save insekticid/29199354b5085f61dd39fd32f8c4e2a9 to your computer and use it in GitHub Desktop.

zonerama.com photo downloader

There is no way, how to download full photo album from zonerama.com when this function has been disabled by author. Here is my workaround - console script to your browser

  1. You have to define sessionId parametr (value of ASP.NET_SessionId cookie name)
  2. Put this command into your browser console and wait
  3. You will get console output with long curl command
  4. Copy this command and run it from your unix console (if you don't know what unix console is, send this command to your geeky friend)
commands='';sessionId='';
$('[data-type=photo]').each(function (i,el) {
commands+='curl -O -J \'' + $(el).data('image-pattern').replace('{width}', $(el).data('width')).replace('{height}', $(el).data('height')).replace('_18_', '_24_') + '\' -H \'Cookie: ASP.NET_SessionId='+sessionId+';\' & ';
}).promise().done( function(){ console.log(commands); } );
@kubiksamek
Copy link

kubiksamek commented Oct 22, 2023

This is great, thanks!

Version with counter (It also keeps order as is in the album/in the DOM):

sessionId = '';

commands = [...document.querySelectorAll('[data-type=photo]')]
    .map((img, i) => {
        return [
            'curl',
            `'${img
                .getAttribute('data-image-pattern')
                .replace('{width}', img.getAttribute('data-width'))
                .replace('{height}', img.getAttribute('data-height'))
                .replace('_18_', '_24_')}'`,
            `-H 'Cookie: ASP.NET_SessionId=${sessionId};'`,
            `--output ${(i + 1).toString().padStart(3, '0')}.jpg`,
            '&',
        ].join(' ');
    })
    .join('\n');

console.log(commands);

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