KurtBestor / Hitomi-Downloader

:cake: Desktop utility to download images/videos/music/text from various websites, and more.
22.18k stars 2.04k forks source link

Request For IMHentai.xxx #6185

Open thegoldenboy542 opened 1 year ago

thegoldenboy542 commented 1 year ago

Can you please put in support for IMHentai.xxx?

Here is the website: https://imhentai.xxx

Can you also make it so that you can search and batch download multiple tagged doujinshis/imagesets at the same time?

For example, downloading all the works from an artist at once, for hitomi.la?

rickmiron commented 1 year ago

Web server is down Error code 521

thegoldenboy542 commented 1 year ago

Web server is down Error code 521

Site should be back up now.

rickmiron commented 1 year ago

Thanks for waiting, here is the plugin: https://github.com/rickmiron/variado/blob/main/imhentai_downloader.py . KurtBestor, please also add this plugin

thegoldenboy542 commented 1 year ago

wait a minute, weren't you on gallery-dl too?

thegoldenboy542 commented 1 year ago

also how do I add the .py file?

rickmiron commented 1 year ago

Here is an instruction: https://github.com/KurtBestor/Hitomi-Downloader/wiki/How-to-write-a-script

thegoldenboy542 commented 1 year ago

So how do I use it? It doesn't show up in search and copy pasting the artists page doesn't work.

rickmiron commented 1 year ago

Try this link: https://imhentai.xxx/gallery/965924/ According to the instructions to create a plugin in hitomi downloader, you can only download a file or a group of files and save them in a folder, not save folders inside another folder, so it is necessary to paste one gallery each time, I can give you a script to capture the galleries of a search or artist and paste them

thegoldenboy542 commented 1 year ago

so it is necessary to paste one gallery each time, I can give you a script to capture the galleries of a search or artist and paste them

Sure thanks.

rickmiron commented 1 year ago

With this javascript code you can get all the links of your search or artist:

const elementos = document.getElementsByClassName('gallery_title');
const galerias = [];

for (let i = 0; i < elementos.length; i++) {
    galerias.push(elementos[i].querySelector('a').href);
  }

let maxpag = document.getElementsByClassName('page-link').length - 1;
let url = document.getElementsByClassName('page-link')[maxpag]?.getAttribute('href');

async function traeGalerias() {
  console.log("pag 1");
  for (let j = 1; url !== '#' ;) {
    const response = await fetch(url);
    const html = await response.text();
    const pagina = (new DOMParser()).parseFromString(html, 'text/html');
    const elementos = pagina.getElementsByClassName('gallery_title');

    for (let i = 0; i < elementos.length; i++) {
      galerias.push(elementos[i].querySelector('a').href);
    }

    console.log("pag", ++j);
    maxpag = pagina.getElementsByClassName('page-link').length - 1;
    url = pagina.getElementsByClassName('page-link')[maxpag].getAttribute('href');
  }
  console.log("ok");
  mostrarGaleria();
}

function mostrarGaleria() {
  document.head.remove();
  document.body.innerHTML = galerias.join("<"+"br>");
}

if (url) {
    traeGalerias();
} else {
    console.log("ok");
    mostrarGaleria();
}
thegoldenboy542 commented 1 year ago

How do I import it into Hitomi?

rickmiron commented 1 year ago

The script is for javascript, it is used in the browser, an example would be chrome: first enter a website https://imhentai.xxx/character/mei-hatsume/ press F12 then in the CONSOLE tab, paste the script and press ENTER

thegoldenboy542 commented 1 year ago

The script is for javascript, it is used in the browser, an example would be chrome: first enter a website https://imhentai.xxx/character/mei-hatsume/ press F12 then in the CONSOLE tab, paste the script and press ENTER

Normal web browser or built-in because pressing f12 in the built in browser doesn't do anything

thegoldenboy542 commented 1 year ago

nvm i figured it out

rickmiron commented 1 year ago

I see that the plugin is sometimes slow in reading, so I updated the plugin: https://github.com/rickmiron/variado/blob/main/imhentai_downloader.py .

thegoldenboy542 commented 1 year ago

With this javascript code you can get all the links of your search or artist:

const elementos = document.getElementsByClassName('gallery_title');
const galerias = [];

for (let i = 0; i < elementos.length; i++) {
    galerias.push(elementos[i].querySelector('a').href);
  }

let maxpag = document.getElementsByClassName('page-link').length - 1;
let url = document.getElementsByClassName('page-link')[maxpag]?.getAttribute('href');

async function traeGalerias() {
  console.log("pag 1");
  for (let j = 1; url !== '#' ;) {
    const response = await fetch(url);
    const html = await response.text();
    const pagina = (new DOMParser()).parseFromString(html, 'text/html');
    const elementos = pagina.getElementsByClassName('gallery_title');

    for (let i = 0; i < elementos.length; i++) {
      galerias.push(elementos[i].querySelector('a').href);
    }

    console.log("pag", ++j);
    maxpag = pagina.getElementsByClassName('page-link').length - 1;
    url = pagina.getElementsByClassName('page-link')[maxpag].getAttribute('href');
  }
  console.log("ok");
  mostrarGaleria();
}

function mostrarGaleria() {
  document.head.remove();
  document.body.innerHTML = galerias.join("<"+"br>");
}

if (url) {
    traeGalerias();
} else {
    console.log("ok");
    mostrarGaleria();
}

Sorry if this is the wrong place to ask but I have a request, would it be possible to rewrite the code to work on e-hentai.org?