ccloli / E-Hentai-Downloader

Download E-Hentai archive as zip file
GNU General Public License v3.0
1.84k stars 138 forks source link

only fetch links without downloading? #175

Closed 0lm closed 3 years ago

0lm commented 3 years ago

is there a way to add the feature to only fetch links, so i can download them with an external download manager to avoid the browser file size limit? this is especially useful for galleries with 1GB+ sizes

ccloli commented 3 years ago

At this time, no, the script doesn't provide such feature, and the images URL are dynamic and will be changed by time, also some H@H nodes may also not accessible that needs to retry to get a new URL, so using an external tool to download may make it worse. If you want to download such large gallery, you can use Pages Range, or other tools that doesn't need to run in browser.

ccloli commented 3 years ago

If you do really want to try this, you can install a very old version like v1.5.1, then modify the source code like this:

Before you do this, you should know that:

  1. The image url is valid when it fetched, but the url may be invalid after a few minutes, so when you download them manually, they may be invalid and only get 404
  2. The image url is not the final url, if you're trying to download original images with multi-thread download tool, your image limits will be cost by multiple times
  3. The default image limits (5000) only lets you download around 500MB files
  4. To download large gallery, it's recommend to download them with torrents (if available) or use your GP or credits to download them from E-Hentai server directly or download with H@H Downloader (you can play HentaiVerse to earn them)
  1. replace from line 7 // @match http://exhentai.org/g/* to line 17 // ==/UserScript== with this block:

    // @include      http://exhentai.org/g/*
    // @include      http://e-hentai.org/g/*
    // @include      http://g.e-hentai.org/g/*
    // @include      http://r.e-hentai.org/g/*
    // @include      https://exhentai.org/g/*
    // @include      https://e-hentai.org/g/*
    // @include      https://g.e-hentai.org/g/*
    // @include      https://r.e-hentai.org/g/*
    // @namespace    http://ext.ccloli.com
    // @updateURL    https://github.com/ccloli/E-Hentai-Downloader/raw/master/e-hentai-downloader.meta.js
    // @downloadURL  https://github.com/ccloli/E-Hentai-Downloader/raw/master/e-hentai-downloader.user.js
    // @supportURL   https://github.com/ccloli/E-Hentai-Downloader/issues
    // @connect      e-hentai.org
    // @connect      exhentai.org
    // @connect      hath.network
    // @connect      *
    // @grant        GM_getValue
    // @grant        GM_setValue
    // @grant        GM_xmlhttpRequest
    // @grant        GM_info
    // @grant        GM.getValue
    // @grant        GM.setValue
    // @grant        GM.xmlHttpRequest
    // @grant        GM.info
    // ==/UserScript==
  2. search for function fetchOriginalImage(index) { and add a line return; after it:

    function fetchOriginalImage(index) {
    +     return;
  3. search for + 'Category: ' + document.getElementsByClassName('ic')[0].getAttribute('alt').toUpperCase() + '\n', replace it with this, or just remove this line:

    + 'Category: ' + document.getElementsByClassName('cs')[0].textContent.toUpperCase() + '\n'
  4. save your changes, refresh gallery page, and click Download This Archive button:
    image

  5. wait until the message dialog shows Fetching Image 1: xxxxxxxxxx ..., then copy all the text in dialog, now you get all the images url at this time. image

0lm commented 3 years ago

thats pretty interesting, thanks! i kind of forgot the default 5000 limit. so i guess even an external downloader wont be able to get the full gallery at once with one try. my bad. thank you for your explanations.