I modified the TH gallery downloader to work here! Enjoy!

mka123

VIP
Mar 26, 2020
10
47
13
Hello all!

I modified the code that was made for TH to download attached images in threads. The same requirements that made it work there, are required to make it work here (Chrome/Firefox and Tampermonkey/Greasemonkey/whatever).

I claim no credit for this original code and I offer no support for it. I just modified it to make it work for me and figured others here could benefit from it too!

Have fun and may we always remember TH!

Code:
// ==UserScript==
// @name         Leakednudes Forum Gallery Downloader - Aug, 15 2020
// @namespace    None
// @description  Download galleries from posts on leakednudes.com
// @version      1.1.2
// @icon         https://i.imgur.com/5xpgAny.jpg
// @license      WTFPL; http://www.wtfpl.net/txt/copying/
// @match        https://leaknudes.com/*
// @match        https://
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @require      https://unpkg.com/[email protected]/dist/jszip.min.js
// @require      https://unpkg.com/[email protected]/dist/FileSaver.min.js
// @require      https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46
// @noframes
// @connect      self
// @run-at       document-start
// @grant        GM.xmlHttpRequest
// @grant        GM_xmlhttpRequest
// ==/UserScript==

/* globals jQuery JSZip saveAs */

jQuery(function ($) {
    $('.message-attribution-opposite')
        .map(function () { return $(this).children('li:first'); })
        .each(function () {
                var downloadLink = $('<li><a href="#">⬇️ Download</a><li>');
                var $text = downloadLink.children('a');
                downloadLink.insertBefore($(this));
                downloadLink.click(function (e) {
                    e.preventDefault();

                    var urls = $(this)
                        .parents('.message-main')
                        .first()
                        .find('a.js-lbImage,.lbContainer-zoomer')
                        .map(function () { return $(this).is('[href]') ? $(this).attr('href') : $(this).data('src'); })
                        .get();

                    var zip = new JSZip(),
                        current = 0,
                        total = urls.length;

                    $text.text('Downloading...');

                    function next () {
                        if (current < total) {
                            $text.text('Downloading ' + (current+1) + '/' + total);

                            GM.xmlHttpRequest({
                                method: 'GET',
                                url: urls[current++],
                                responseType: 'arraybuffer',
                                onload: function (response) {
                                    try {
                                        debugger;
                                        var name = response.responseHeaders.match(/^content-disposition.+(?:filename=)(.+)$/mi)[1].replace(/\"/g, '');
                                        var data = response.response;
                                        zip.file(name, data);
                                    }
                                    catch (err) {

                                    }

                                    next();
                                },
                                onerror: function (response) {
                                    next();
                                }
                            });
                        }
                        else {
                            const fileName = $(".p-title-value")[0].textContent
                            const timeStamp = $.now()
                            $text.text('Generating zip...');
                            zip.generateAsync({ type: 'blob' })
                                .then(function (blob) {
                                    $text.text('Download complete!');
                                    saveAs(blob, `${fileName}-${timeStamp}.zip`);
                                });

                        }
                    }
                    next();
                });
            }
        );
});
 

mka123

VIP
Mar 26, 2020
10
47
13
UPDATE: I noticed sometimes the URLs switch from "leaknudes.com" and "ibradome.com", so I made a change to catch both. Use this updated version to ensure it works for you more often. It's also really slow to download, I know. That's not the code, that's the server side of the site.



Code:
// ==UserScript==

// @name         Leakednudes Forum Gallery Downloader - Aug, 15 2020

// @namespace    None

// @description  Download galleries from posts on leakednudes.com

// @version      1.1.2

// @icon         https://i.imgur.com/5xpgAny.jpg

// @license      WTFPL; http://www.wtfpl.net/txt/copying/

// @match        https://leaknudes.com/*

// @match        https://www.ibradome.com/*

// @match        https://

// @require      https://code.jquery.com/jquery-3.3.1.min.js

// @require      https://unpkg.com/[email protected]/dist/jszip.min.js

// @require      https://unpkg.com/[email protected]/dist/FileSaver.min.js

// @require      https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46

// @noframes

// @connect      self

// @run-at       document-start

// @grant        GM.xmlHttpRequest

// @grant        GM_xmlhttpRequest

// ==/UserScript==


/* globals jQuery JSZip saveAs */


jQuery(function ($) {

    $('.message-attribution-opposite')

        .map(function () { return $(this).children('li:first'); })

        .each(function () {

                var downloadLink = $('<li><a href="#">⬇ Download</a><li>');

                var $text = downloadLink.children('a');

                downloadLink.insertBefore($(this));

                downloadLink.click(function (e) {

                    e.preventDefault();


                    var urls = $(this)

                        .parents('.message-main')

                        .first()

                        .find('a.js-lbImage,.lbContainer-zoomer')

                        .map(function () { return $(this).is('[href]') ? $(this).attr('href') : $(this).data('src'); })

                        .get();


                    var zip = new JSZip(),

                        current = 0,

                        total = urls.length;


                    $text.text('Downloading...');


                    function next () {

                        if (current < total) {

                            $text.text('Downloading ' + (current+1) + '/' + total);


                            GM.xmlHttpRequest({

                                method: 'GET',

                                url: urls[current++],

                                responseType: 'arraybuffer',

                                onload: function (response) {

                                    try {

                                        debugger;

                                        var name = response.responseHeaders.match(/^content-disposition.+(?:filename=)(.+)$/mi)[1].replace(/\"/g, '');

                                        var data = response.response;

                                        zip.file(name, data);

                                    }

                                    catch (err) {


                                    }


                                    next();

                                },

                                onerror: function (response) {

                                    next();

                                }

                            });

                        }

                        else {

                            const fileName = $(".p-title-value")[0].textContent

                            const timeStamp = $.now()

                            $text.text('Generating zip...');

                            zip.generateAsync({ type: 'blob' })

                                .then(function (blob) {

                                    $text.text('Download complete!');

                                    saveAs(blob, `${fileName}-${timeStamp}.zip`);

                                });


                        }

                    }

                    next();

                });

            }

        );

});
 
Last edited by a moderator:
Comment

Kiropraxis

Aug 6, 2020
36
277
363
Not working here.

I installed it now in Tampermonkey and tried to download a gallery with your script but it doesn't seems to recognize it.

What am I supposed to do?
 
Comment

mka123

VIP
Mar 26, 2020
10
47
13
It will only download images directly uploaded to the site here. It will not download images that are hosted elsewhere. It's worked on every thread I've used it on, so...I'm not sure what's going on with yours.
 
Comment

lurchi

Aug 20, 2020
7
42
13
for me, i had to modify the "catching urls" description to make it work.
change
Code:
// @match        https://www.ibradome.com/*
to
Code:
// @match        https://*.ibradome.com/*
and it will catch also the subdomains (as we are in a subdomain "forums" here.)
hope that helps :)
best regards,
new guy ;)
 
Comment

lurchi

Aug 20, 2020
7
42
13
I've modified the script to work with the changed URL. 1
It's easily expandable for forums which base on the same forum software, just add the correct URL.
Have a nice day everyone :)


JavaScript:
// ==UserScript==
// @name         Forum Gallery Downloader
// @namespace    modified by lurch
// @description  Download galleries from posts
// @version      1.3
// @icon         https://i.imgur.com/5xpgAny.jpg
// @license      WTFPL; http://www.wtfpl.net/txt/copying/
// @match        https://forum.lewdweb.net/*
// @match        https://*.leaknudes.com/*
// @match        https://*.ibradome.com/*
// @match        https://*.xBunker.com/*
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @require      https://unpkg.com/[email protected]/dist/jszip.min.js
// @require      https://unpkg.com/[email protected]/dist/FileSaver.min.js
// @require      https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46
// @noframes
// @connect      self
// @run-at       document-start
// @grant        GM.xmlHttpRequest
// @grant        GM_xmlhttpRequest
// ==/UserScript==

/* globals jQuery JSZip saveAs */

jQuery(function ($) {
   $('.message-attribution-opposite')
        .map(function () { return $(this).children('li:first'); })
        .each(function () {
                var downloadLink = $('<li><a href="#" class="downloadSinglePost">↓ Download</a><li>');
                var $text = downloadLink.children('a');
                downloadLink.insertBefore($(this));
                downloadLink.click(function (e) {
                    e.preventDefault();

                    var $this = $(this);
                    var urls = $(this)
                        .parents('.message-main')
                        .first()
                        .find('a.js-lbImage,.lbContainer-zoomer')
                        .map(function () { return $(this).is('[href]') ? $(this).attr('href') : $(this).data('src'); })
                        .get();

                    var current = 0,
                        total = urls.length,
                        zip = (zip === undefined) ? new JSZip() : zip;
                   collectDownloads($this,$text,zip,current,total,urls);
                });
            }
        );

    // download function
    function collectDownloads(loc,info,zip,current,total,urls) {
      //  check if downloads available
      if (total>0) {
        info.text('Downloading...');

                       if (current < total) {
                            info.text('Downloading ' + (current+1) + '/' + total);

                            GM.xmlHttpRequest({
                                method: 'GET',
                                url: urls[current++],
                                responseType: 'arraybuffer',
                                onload: function (response) {
                                    try {
                                        debugger;
                                        var name = response.responseHeaders.match(/^content-disposition.+(?:filename=)(.+)$/mi)[1].replace(/\"/g, '');
                                        var data = response.response;
                                        zip.file(name, data);
                                    }
                                    catch (err) {

                                    }
                                    collectDownloads(loc,info,zip,current,total,urls);
                                },
                                onerror: function (response) {
                                    collectDownloads(loc,info,zip,current,total,urls);
                                }
                            });
                        }
                        else {
                            var title = $('h1.p-title-value').text().trim();
                            var postNumber = loc.closest('ul.message-attribution-opposite').find('li:last-child > a').text();
                            info.text('Generating zip...');
                            zip.generateAsync({ type: 'blob' })
                                .then(function (blob) {
                                    info.text('Download complete!');
                                    saveAs(blob, postNumber + ' ' + title + '.zip');
                                });

                        }

      } else {
          info.text( (current==0 ? 'No Downloads!' : 'Downloads finished!') );
      }

    }

   // add 'download all' button
   var downloadAllLink = $('<a href="#" class="downloadAllFiles">↓ Download All</a>');
   $("div.buttonGroup").css({'display':'inline-flex','flex-wrap':'wrap','gap':'12px','align-items':'center','margin-right':'-12px'}).prepend(downloadAllLink);

   // download all files on page
   $(document).on("click",".downloadAllFiles",function(e){
       e.preventDefault();
       var urls = $('.lbContainer a.js-lbImage,.lbContainer-zoomer')
                     .map(function () { return $(this).is('[href]') ? $(this).attr('href') : $(this).data('src'); })
                     .get();

       var current = 0,
           total = urls.length,
           zip = (zip === undefined) ? new JSZip() : zip;

           collectDownloads($('.lbContainer'),downloadAllLink,zip,current,total,urls);
   });
});
 
Comment
Aug 22, 2022
1
12
3
i was having issues getting the script to work. then i realized the url was wrong in script for xbunker. so i modified it with correct one. the original script had it as xbunker.com, but the new url is now xbunker.nu. now the script works. here it is:




JavaScript:
//==UserScript==
// @name         Forum Gallery Downloader
// @namespace    modified by J4k_The_Reaper
// @description  Download galleries from posts
// @version      1.3
// @icon         https://i.imgur.com/5xpgAny.jpg
// @license      WTFPL; http://www.wtfpl.net/txt/copying/
// @match        https://forum.lewdweb.net/*
// @match        https://*.leaknudes.com/*
// @match        https://*.ibradome.com/*
// @match        https://*.xbunker.nu/*
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @require      https://unpkg.com/[email protected]/dist/jszip.min.js
// @require      https://unpkg.com/[email protected]/dist/FileSaver.min.js
// @require      https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46
// @noframes
// @connect      self
// @run-at       document-start
// @grant        GM.xmlHttpRequest
// @grant        GM_xmlhttpRequest
// ==/UserScript==

/* globals jQuery JSZip saveAs */

jQuery(function ($) {
   $('.message-attribution-opposite')
        .map(function () { return $(this).children('li:first'); })
        .each(function () {
                var downloadLink = $('<li><a href="#" class="downloadSinglePost">↓ Download</a><li>');
                var $text = downloadLink.children('a');
                downloadLink.insertBefore($(this));
                downloadLink.click(function (e) {
                    e.preventDefault();

                    var $this = $(this);
                    var urls = $(this)
                        .parents('.message-main')
                        .first()
                        .find('a.js-lbImage,.lbContainer-zoomer')
                        .map(function () { return $(this).is('[href]') ? $(this).attr('href') : $(this).data('src'); })
                        .get();

                    var current = 0,
                        total = urls.length,
                        zip = (zip === undefined) ? new JSZip() : zip;
                   collectDownloads($this,$text,zip,current,total,urls);
                });
            }
        );

    // download function
    function collectDownloads(loc,info,zip,current,total,urls) {
      //  check if downloads available
      if (total>0) {
        info.text('Downloading...');

                       if (current < total) {
                            info.text('Downloading ' + (current+1) + '/' + total);

                            GM.xmlHttpRequest({
                                method: 'GET',
                                url: urls[current++],
                                responseType: 'arraybuffer',
                                onload: function (response) {
                                    try {
                                        debugger;
                                        var name = response.responseHeaders.match(/^content-disposition.+(?:filename=)(.+)$/mi)[1].replace(/\"/g, '');
                                        var data = response.response;
                                        zip.file(name, data);
                                    }
                                    catch (err) {

                                    }
                                    collectDownloads(loc,info,zip,current,total,urls);
                                },
                                onerror: function (response) {
                                    collectDownloads(loc,info,zip,current,total,urls);
                                }
                            });
                        }
                        else {
                            var title = $('h1.p-title-value').text().trim();
                            var postNumber = loc.closest('ul.message-attribution-opposite').find('li:last-child > a').text();
                            info.text('Generating zip...');
                            zip.generateAsync({ type: 'blob' })
                                .then(function (blob) {
                                    info.text('Download complete!');
                                    saveAs(blob, postNumber + ' ' + title + '.zip');
                                });

                        }

      } else {
          info.text( (current==0 ? 'No Downloads!' : 'Downloads finished!') );
      }

    }

   // add 'download all' button
   var downloadAllLink = $('<a href="#" class="downloadAllFiles">↓ Download All</a>');
   $("div.buttonGroup").css({'display':'inline-flex','flex-wrap':'wrap','gap':'12px','align-items':'center','margin-right':'-12px'}).prepend(downloadAllLink);

   // download all files on page
   $(document).on("click",".downloadAllFiles",function(e){
       e.preventDefault();
       var urls = $('.lbContainer a.js-lbImage,.lbContainer-zoomer')
                     .map(function () { return $(this).is('[href]') ? $(this).attr('href') : $(this).data('src'); })
                     .get();

       var current = 0,
           total = urls.length,
           zip = (zip === undefined) ? new JSZip() : zip;

           collectDownloads($('.lbContainer'),downloadAllLink,zip,current,total,urls);
   });
});
 
nonameprofile
nonameprofile commented
I get a "no downloads" message
 
J
J4k_The_Reaper commented

same. i wish there was a script that actually works on this site!!