Topic: [script] e621's lazy mass downloader

Posted under e621 Tools and Applications

lazy because it doesn't directly download anything :p

What does this script do?

This script will generate a direct link list of all post in your current search page. You can then copy paste that list in the download manager of you choice (or with wget ๐Ÿง). The script will exclude from the list any blacklisted elements.

How do i use this script?

Step 1: Install it
You'll need greasemonkey on firefox or tampermonkey on chrome. Create a new script and copy paste the source code.

Step 2: Do a search

Step 3: Click the button above the search bar

Step 4: Copy paste the list
Tip: click in the square, then ctrl-a ctrl-c

Step 5: Download
With a download manager that support copy paste of multiple links, or wget -i pasted_the_list_here.txt

Source code
// ==UserScript==
// @name        e621's lazy mass downloader
// @namespace   e621
// @description e621's lazy mass downloader
// @include     *e621.net/post/index*
// @version     1
// @grant       none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// ==/UserScript==
function isInBlack(tvalue, tarray) {
  for (j = 0; j < tarray.length; j++) {
    if (tarray[j] == tvalue) {
      tarray.splice(j, 1);
      return [true,tarray];
    }
  }
  return [false,tarray];
}
$(document).ready(function () {
  $('#post-list .sidebar').prepend('<div style="margin-bottom: 1em;"><button id="downPost">Generate direct links</button></div>');
  $('#downPost').click(function () {
    $('#downPost').after('<p>Generating links...</p>');
    var blackID = [];
    $('.blacklisted').each(function () {
      var spanID = $(this).attr('id');
      spanID = spanID.slice(1);
      blackID.push(spanID);
    });
    var expr=/https?:\\/\\/e621\\.net\\/post\\/index\\/(\d+)\\/?.*/i;
    var rege=expr.exec(window.location.href);
    var page="page=";
    if(rege==null){
      page+=1;
    }else{
      page+=rege[1];
    }
    var tags="tags=";
    if($('#tags').val()!=""){
      tags+=$('#tags').val()+"&";
    }else{
      tags="";
    }
    $.get('https://e621.net/post/index.json?'+tags+page, function (data, status) {
      if(status!="success"){
        $('#downPost').after('<p>Error '+status+' whille getting '+'https://e621.net/post/index.json?'+tags+page+'</p>');
      }else{
        $('#post-list').prepend('<textarea id="linkList"></textarea>');
        for (i = 0; i < data.length; i++) {
          var inBlack = isInBlack(data[i].id, blackID);
          blackID = inBlack[1];
          if (!inBlack[0]) {
            $('#linkList').val($('#linkList').val() + data[i].file_url+'\n');
          }
        }
      }
    });
  });
});

Known issues

You can't toggle off your blacklist while this script is active.

Updated by Magidog

Zenti said:
*snip*

Hmm... doesn't seem to be working for me on Ubuntu 17.04... I don't see any kind of "Generate" button above my search bar...

Updated by anonymous

Faux-Pa said:
Hmm... doesn't seem to be working for me on Ubuntu 17.04... I don't see any kind of "Generate" button above my search bar...

Found the problem: the forum was erasing backslashes from the code. It should work now.

Updated by anonymous

Thank you SO VERY MUCH!! It's been weeks that I've been looking for a way to mass download searches and not just pools.

Updated by anonymous

  • 1