JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 01.02.2020, 15:04
damo damo is offline
Baby Loader
 
Join Date: Jan 2020
Posts: 8
Lightbulb hitomi.la (webp)

Since the recent fix for hitomi.la (https://board.jdownloader.org/showthread.php?t=82787) the downloader only offers webp, although the original image formats are still available. It would be great if there was an option to download the original formats (jpg/png) instead. Furthermore, it would be nice to have an option to use the suggested filenames.


If you call the equivalent of the javascript function url_from_url_from_hash with only two arguments you should get the non-webp version.
Reply With Quote
  #2  
Old 01.02.2020, 16:44
9z478vj9oh 9z478vj9oh is offline
Baby Loader
 
Join Date: Oct 2019
Posts: 6
Default

I would like to second this bug report. Also, it seems like the decrypter still has problem with decrypting some of the links, as I am getting 403 on many of the pages.

02.02.20 00.41.05 <--> 02.02.20 00.43.30 jdlog://1103430900751/

Example URL: **External links are only visible to Support Staff****External links are only visible to Support Staff** (NSFW warning)

Thank you very much.
Reply With Quote
  #3  
Old 03.02.2020, 15:19
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Quote:
Originally Posted by damo View Post
Furthermore, it would be nice to have an option to use the suggested filenames.


If you call the equivalent of the javascript function url_from_url_from_hash with only two arguments you should get the non-webp version.
An option is not required.

We try to download the highest quality by default but in this case, there was no way for me to know that a different version exists.

Does this also work via website?
Please post detailed instructions on how to get these mentioned original versions.

Quote:
Originally Posted by 9z478vj9oh View Post
I would like to second this bug report. Also, it seems like the decrypter still has problem with decrypting some of the links, as I am getting 403 on many of the pages.
Maybe the forum user Etshy is still there and wants to help me out.

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #4  
Old 03.02.2020, 16:13
Etshy Etshy is offline
Junior Loader
 
Join Date: Oct 2019
Posts: 13
Default

Quick reply, I'm at work right now.
From what I remember the png/jpg link are "faked", always return 403, at least. The real src of the images are webp.
On the comics I looked to fix the bug.

You can still convert webp to jpg/png, I did in my js script I shared. I guess it should be possible to do it in java too.
Reply With Quote
  #5  
Old 03.02.2020, 16:18
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Maybe you can just come back to this later - I'll probably still be around.
I've also send you a PN with an URL which currently is not downloadable via JD.
Thanks

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #6  
Old 03.02.2020, 19:09
Etshy Etshy is offline
Junior Loader
 
Join Date: Oct 2019
Posts: 13
Default

Saw the comic's link you sent me. from what I quickly saw, there is no webp for this comic. If you "copied" the js function from hitomi. I guess this is just some arguments to change and that makes the "calcul" to find the subdomain to change.
the subdomain you sent me was ca. and the "real" subdomain is ba.

I dn't really understand why the url you generated is wrong, from what I tested here : **External links are only visible to Support Staff**... the first letter of the subdomain is found correctly.

Is there some value that changed compared to your JAVA file ?
Reply With Quote
  #7  
Old 03.02.2020, 19:15
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Indeed I had a small bug in there which simply set the wrong extension although the correct one was known but still there are some files which cannot be downloaded.
Please wait for the next update and try again ...

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #8  
Old 03.02.2020, 19:20
Etshy Etshy is offline
Junior Loader
 
Join Date: Oct 2019
Posts: 13
Default

Is the comic you sent me is a part of the files that can't be downloaded ?
If so, I don't really understand why. If you guess the "images/webp" folder and the subdomain part, everything should be fine. (I think)
Reply With Quote
  #9  
Old 03.02.2020, 19:23
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

As said, wait for the update and re-add the URLs.
You ll seer htat you have the update when the file-extension of these images is correct and not .webp anymore.

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #10  
Old 03.02.2020, 19:25
Etshy Etshy is offline
Junior Loader
 
Join Date: Oct 2019
Posts: 13
Default

Well personnaly I installed the Google webP codec to read webP with windows images reader, so it doesn't bother me that much to have webp ^^

But we'll see with next update.
Reply With Quote
  #11  
Old 03.02.2020, 19:27
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Quote:
Originally Posted by Etshy View Post
Well personnaly I installed the Google webP codec to read webP with windows images reader, so it doesn't bother me that much to have webp ^^
Maybe you misunderstood me.
Some of their images simply are not available in webp this is why some of these ones failed.
Their json contains a boolean "haswebp"

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #12  
Old 03.02.2020, 19:31
Etshy Etshy is offline
Junior Loader
 
Join Date: Oct 2019
Posts: 13
Default

Oh yeah, I thought you handle that already.
the haswebp bool seems to change the part of the url "/webp" into "/images.
in their common.js it's defined here

function url_from_hash(galleryid, image, dir, ext) {
ext = ext || dir || image.name.split('.').pop();
dir = dir || 'images';

seems they either pass 'webp' or nothing (to have 'images' by default)
I can't guarantee that, but I didn't see any other case for now
Reply With Quote
  #13  
Old 03.02.2020, 19:34
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Yap I handle this already but either something is wrong in my code or some pics are broken/offline serverside.

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #14  
Old 05.02.2020, 21:41
damo damo is offline
Baby Loader
 
Join Date: Jan 2020
Posts: 8
Default

Quote:
We try to download the highest quality by default but in this case, there was no way for me to know that a different version exists.
The galleryinfo actually contains the file name as well as a flag "haswebp" to indicate if webp is available.
Code:
var galleryinfo = [{"width":192,"hash":"701a16171535fd23e34aa96b2de64c169b16fc196ef5926150ec4a413099ca57","haswebp":1,"name":"embed0000.jpg","height":300,"hasavif":0}, /*...*/];
Quote:
Does this also work via website?
You can toggle between webp and original in the viewer with the "w" key.
And the offered "Download" functionality also uses the original extension and not webp. The "Download" button uses the "download_gallery" function from **External links are only visible to Support Staff****External links are only visible to Support Staff** which uses some functions from **External links are only visible to Support Staff****External links are only visible to Support Staff**.
Reply With Quote
  #15  
Old 06.02.2020, 12:40
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Hm I see the problem is the wrong subdomains we are using which is the reason why some pics cannot be downloaded:
ltn.hitomi.la/common.js --> subdomain_from_url
If you have any idea on how to write this in Java, let me know.
This is our current equivalent to "subdomain_from_url" which seems to be outdated:
Code:
    /**
     * they do some javascript trickery (check reader.js,common.js). rewritten in java.
     *
     * @param guid
     * @return
     * @throws DecrypterException
     */
    private String getImageHost(final String guid) throws DecrypterException {
        // number of subdmains, var number_of_frontends = 3;
        final int i = 3;
        // guid is always present, so not sure why they have failover. That said you don't need subdomain either base domain works also!
        String g = new Regex(guid, "^\\d*(\\d)$").getMatch(0);
        if (false && "1".equals(g)) {
            g = "0";
        }
        final String subdomain = Character.toString((char) (97 + (Integer.parseInt(g) % i)));
        return subdomain;
    }
-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #16  
Old 08.02.2020, 18:14
damo damo is offline
Baby Loader
 
Join Date: Jan 2020
Posts: 8
Post

Here is are all the functions you should need, scroll down to the implementation. First is the original javascript code, after that a test, then the actual code.

Code:
package com.example.demo;

import java.util.*;
import java.util.regex.*;

import org.junit.*;

/*
var adapose = false;
function subdomain_from_galleryid(g, number_of_frontends) {
        if (adapose) {
                return '0';
        }

        var o = g % number_of_frontends;

        return String.fromCharCode(97 + o);
}

function subdomain_from_url(url, base) {
        var retval = 'a';
        if (base) {
                retval = base;
        }

        var number_of_frontends = 3;
        var b = 16;

        var r = /\/[0-9a-f]\/([0-9a-f]{2})\//;
        var m = r.exec(url);
        if (!m) {
                return retval;
        }

        var g = parseInt(m[1], b);
        if (!isNaN(g)) {
                if (g < 0x30) {
                        number_of_frontends = 2;
                }
                if (g < 0x09) {
                        g = 1;
                }
                retval = subdomain_from_galleryid(g, number_of_frontends) + retval;
        }

        return retval;
}

function url_from_url(url, base) {
        return url.replace(/\/\/..?\.hitomi\.la\//, '//'+subdomain_from_url(url, base)+'.hitomi.la/');
}


function full_path_from_hash(hash) {
        if (hash.length < 3) {
                return hash;
        }
        return hash.replace(/^.*(..)(.)$/, '$2/$1/'+hash);
}


function url_from_hash(galleryid, image, dir, ext) {
        ext = ext || dir || image.name.split('.').pop();
        dir = dir || 'images';

        return '//a.hitomi.la/'+dir+'/'+full_path_from_hash(image.hash)+'.'+ext;
}

function url_from_url_from_hash(galleryid, image, dir, ext, base) {
        return url_from_url(url_from_hash(galleryid, image, dir, ext), base);
}

 */
public class Hito {
  /*
  url_from_url_from_hash("1566712", {"width":300,"hash":"4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3","haswebp":1,"name":"1.jpg","height":241,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmallsmalltn/3/af/4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3","haswebp":1,"name":"1.jpg","height":241,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmalltn/3/af/4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3","haswebp":1,"name":"1.jpg","height":241,"hasavif":0}, "smalltn", "jpg","tn") -> "//btn.hitomi.la/smalltn/3/af/4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53","haswebp":1,"name":"2.jpg","height":241,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//ctn.hitomi.la/webpsmallsmalltn/3/f5/f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53","haswebp":1,"name":"2.jpg","height":241,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//ctn.hitomi.la/webpsmalltn/3/f5/f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53","haswebp":1,"name":"2.jpg","height":241,"hasavif":0}, "smalltn", "jpg","tn") -> "//ctn.hitomi.la/smalltn/3/f5/f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858","haswebp":1,"name":"3.jpg","height":241,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmallsmalltn/8/85/692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858","haswebp":1,"name":"3.jpg","height":241,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmalltn/8/85/692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858","haswebp":1,"name":"3.jpg","height":241,"hasavif":0}, "smalltn", "jpg","tn") -> "//btn.hitomi.la/smalltn/8/85/692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5","haswebp":1,"name":"4.jpg","height":241,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmallsmalltn/5/cd/1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5","haswebp":1,"name":"4.jpg","height":241,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmalltn/5/cd/1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5","haswebp":1,"name":"4.jpg","height":241,"hasavif":0}, "smalltn", "jpg","tn") -> "//btn.hitomi.la/smalltn/5/cd/1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285","haswebp":1,"name":"5.jpg","height":226,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//atn.hitomi.la/webpsmallsmalltn/5/28/b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285","haswebp":1,"name":"5.jpg","height":226,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//atn.hitomi.la/webpsmalltn/5/28/b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":300,"hash":"b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285","haswebp":1,"name":"5.jpg","height":226,"hasavif":0}, "smalltn", "jpg","tn") -> "//atn.hitomi.la/smalltn/5/28/b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976","haswebp":1,"name":"6.jpg","height":300,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmallsmalltn/6/97/152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976","haswebp":1,"name":"6.jpg","height":300,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmalltn/6/97/152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976","haswebp":1,"name":"6.jpg","height":300,"hasavif":0}, "smalltn", "jpg","tn") -> "//btn.hitomi.la/smalltn/6/97/152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011","haswebp":1,"name":"7.jpg","height":300,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmallsmalltn/1/01/ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011","haswebp":1,"name":"7.jpg","height":300,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//btn.hitomi.la/webpsmalltn/1/01/ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011","haswebp":1,"name":"7.jpg","height":300,"hasavif":0}, "smalltn", "jpg","tn") -> "//btn.hitomi.la/smalltn/1/01/ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011.jpg" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745","haswebp":1,"name":"8.jpg","height":300,"hasavif":0}, "webpsmallsmalltn", "webp","tn") -> "//ctn.hitomi.la/webpsmallsmalltn/5/74/c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745","haswebp":1,"name":"8.jpg","height":300,"hasavif":0}, "webpsmalltn", "webp","tn") -> "//ctn.hitomi.la/webpsmalltn/5/74/c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745.webp" common.js:70:8
  url_from_url_from_hash("1566712", {"width":202,"hash":"c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745","haswebp":1,"name":"8.jpg","height":300,"hasavif":0}, "smalltn", "jpg","tn") -> "//ctn.hitomi.la/smalltn/5/74/c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745.jpg" common.js:70:8
  */

  @Test
  public void test() {
    Assert.assertEquals( "//btn.hitomi.la/webpsmallsmalltn/3/af/4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3.webp", url_from_url_from_hash("1566712", mapOf("4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3", "1.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmalltn/3/af/4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3.webp", url_from_url_from_hash("1566712", mapOf("4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3", "1.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/smalltn/3/af/4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3.jpg", url_from_url_from_hash("1566712", mapOf("4616e0234c44ca6748546a4eee701efe88d338e7809a72c81fc0576c9e3f9af3", "1.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//ctn.hitomi.la/webpsmallsmalltn/3/f5/f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53.webp", url_from_url_from_hash("1566712", mapOf("f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53", "2.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//ctn.hitomi.la/webpsmalltn/3/f5/f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53.webp", url_from_url_from_hash("1566712", mapOf("f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53", "2.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//ctn.hitomi.la/smalltn/3/f5/f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53.jpg", url_from_url_from_hash("1566712", mapOf("f88d8c37a29d7df775ab478c803970e208ea183049af5ece7b0abfd909f4ff53", "2.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmallsmalltn/8/85/692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858.webp", url_from_url_from_hash("1566712", mapOf("692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858", "3.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmalltn/8/85/692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858.webp", url_from_url_from_hash("1566712", mapOf("692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858", "3.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/smalltn/8/85/692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858.jpg", url_from_url_from_hash("1566712", mapOf("692e0ab1eae1184c0a34e5e801e5769c2e80ccd1ac9c62abfec1cc3b32d9d858", "3.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmallsmalltn/5/cd/1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5.webp", url_from_url_from_hash("1566712", mapOf("1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5", "4.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmalltn/5/cd/1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5.webp", url_from_url_from_hash("1566712", mapOf("1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5", "4.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/smalltn/5/cd/1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5.jpg", url_from_url_from_hash("1566712", mapOf("1070c2c2233886dc3ff0e38afd45ce6c66153118b995379e6f6e39f6410c2cd5", "4.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//atn.hitomi.la/webpsmallsmalltn/5/28/b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285.webp", url_from_url_from_hash("1566712", mapOf("b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285", "5.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//atn.hitomi.la/webpsmalltn/5/28/b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285.webp", url_from_url_from_hash("1566712", mapOf("b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285", "5.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//atn.hitomi.la/smalltn/5/28/b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285.jpg", url_from_url_from_hash("1566712", mapOf("b15aa86f9fb459ec60dd82f8ca142e80ec6d11fe87f8a2db1b2b8e8c47f0f285", "5.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmallsmalltn/6/97/152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976.webp", url_from_url_from_hash("1566712", mapOf("152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976", "6.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmalltn/6/97/152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976.webp", url_from_url_from_hash("1566712", mapOf("152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976", "6.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/smalltn/6/97/152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976.jpg", url_from_url_from_hash("1566712", mapOf("152d981622fe31781498da5b1e42963abafda46f7942760baa2e35b06b309976", "6.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmallsmalltn/1/01/ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011.webp", url_from_url_from_hash("1566712", mapOf("ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011", "7.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/webpsmalltn/1/01/ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011.webp", url_from_url_from_hash("1566712", mapOf("ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011", "7.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//btn.hitomi.la/smalltn/1/01/ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011.jpg", url_from_url_from_hash("1566712", mapOf("ba00573b20260b0ad87578d59ad273ec15f9e70dc13ac579066665b89e49f011", "7.jpg"), "smalltn", "jpg", "tn"));
    Assert.assertEquals( "//ctn.hitomi.la/webpsmallsmalltn/5/74/c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745.webp", url_from_url_from_hash("1566712", mapOf("c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745", "8.jpg"), "webpsmallsmalltn", "webp", "tn"));
    Assert.assertEquals( "//ctn.hitomi.la/webpsmalltn/5/74/c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745.webp", url_from_url_from_hash("1566712", mapOf("c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745", "8.jpg"), "webpsmalltn", "webp", "tn"));
    Assert.assertEquals( "//ctn.hitomi.la/smalltn/5/74/c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745.jpg", url_from_url_from_hash("1566712", mapOf("c695e220937ea67f3ab73d947c1b3d6ddfd45f3009ef9f0ee59dbf40b457c745", "8.jpg"), "smalltn", "jpg", "tn"));
  }

  Map<String, String> mapOf(String hash, String name) {
    HashMap<String, String> m = new HashMap<>();
    m.put("hash", hash);
    m.put("name", name);
    return m;
  }

  ///////////////////////////////////////////////////////////////////////
  ///////////////////////    Implementation Below   /////////////////////
  ///////////////////////////////////////////////////////////////////////
  
  public static final Pattern SUBDOMAIN_FROM_URL_PATTERN = Pattern.compile("/[0-9a-f]/([0-9a-f]{2})/");
  public static final Pattern URL_FROM_URL_PATTERN = Pattern.compile("//..?\\.hitomi\\.la/");
  public static final Pattern FULL_PATH_FROM_HASH_PATTERN = Pattern.compile("^.*(..)(.)$");



  String subdomain_from_galleryid(int g, int number_of_frontends) {
    int o = g % number_of_frontends;

    return String.valueOf((char)(97 + o));
  }

  String subdomain_from_url(String url, String base) {
    String retval = "a";
    if (base != null) {
      retval = base;
    }

    int number_of_frontends = 3;

    Matcher m = SUBDOMAIN_FROM_URL_PATTERN.matcher(url);
    if (!m.find()) {
      return retval;
    }

    try {
      int g = Integer.parseInt(m.group(1), 16);
      if (g < 0x30) {
        number_of_frontends = 2;
      }
      if (g < 0x09) {
        g = 1;
      }
      retval = subdomain_from_galleryid(g, number_of_frontends) + retval;
    } catch (NumberFormatException ignore) {}

    return retval;
  }

  String url_from_url(String url, String base) {
    return URL_FROM_URL_PATTERN.matcher(url).replaceAll("//" + subdomain_from_url(url, base) + ".hitomi.la/");
  }


  String full_path_from_hash(String hash) {
    if (hash.length() < 3) {
      return hash;
    }
    return FULL_PATH_FROM_HASH_PATTERN.matcher(hash).replaceAll("$2/$1/" + hash);
  }

  String url_from_hash(String galleryid, Map<String, String> image, String dir, String ext) {
    ext = isNotBlank(ext) ? ext : (isNotBlank(dir) ? dir :
        image.get("name").split("\\.")[1]);
    dir = isNotBlank(dir) ? dir : "images";

    return "//a.hitomi.la/" + dir + '/' + full_path_from_hash(image.get("hash")) + '.' + ext;
  }

  String url_from_url_from_hash(String galleryid, Map<String, String> image, String dir, String ext, String base) {
    return url_from_url(url_from_hash(galleryid, image, dir, ext), base);
  }

  boolean isNotBlank(String str) {
    return str != null && !str.isEmpty();
  }
}
Reply With Quote
  #17  
Old 09.02.2020, 13:14
9z478vj9oh 9z478vj9oh is offline
Baby Loader
 
Join Date: Oct 2019
Posts: 6
Default

Hello,

I just updated to the latest version and pasted in a few more links. Many of them worked now, but I found some more links that have trouble fetching the photos, despite the LinkGrabber page shows all online.

**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1, 23-25)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1-5, 33-35)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (All fail)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (All fail)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (All fail)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1-35)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1-27, and 29)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1-30)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1, 5-26, 28, 31)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1, 23, 27, 28)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1 and 26)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (All fail)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (All fail)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1, 4-8, 13-14, 24, 28-29)
**External links are only visible to Support Staff****External links are only visible to Support Staff** (Only got 1, 3, 28-31)

Thank you very much for looking into this.
Reply With Quote
  #18  
Old 10.02.2020, 15:02
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

@9z478vj9oh
This is exactly the issue described before.

@damo
Thanks.

Unfortunately I have no idea what you are using as "base".

I've added your code but it does not yet get used.
Please give me an advice.

Wartest du auf einen angekündigten Bugfix oder ein neues Feature?
Updates werden nicht immer sofort bereitgestellt!
Bitte lies unser Update FAQ! | Please read our Update FAQ!

---
Are you waiting for recently announced changes to get released?
Updates to not necessarily get released immediately!
Bitte lies unser Update FAQ! | Please read our Update FAQ!


-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #19  
Old 10.02.2020, 15:47
damo damo is offline
Baby Loader
 
Join Date: Jan 2020
Posts: 8
Default

Quote:
Unfortunately I have no idea what you are using as "base".
The code calls the function for the full-size images with
Code:
url_from_url_from_hash("1567540", {"width":300,"hash":"f3839b72148cb8e57278ba161a3283014da3ff5597a1262480d44cc9022b5a7a","haswebp":1,"name":"01_01.png","height":168,"hasavif":1}, "undefined", "undefined","undefined")
so basically dir,ext,base are all null.

Code:
 Assert.assertEquals( "//ca.hitomi.la/images/a/a7/f3839b72148cb8e57278ba161a3283014da3ff5597a1262480d44cc9022b5a7a.png", url_from_url_from_hash("1567540",mapOf("f3839b72148cb8e57278ba161a3283014da3ff5597a1262480d44cc9022b5a7a","01_01.png"), null, null,null));
Reply With Quote
  #20  
Old 10.02.2020, 16:09
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,420
Default

Well this is exactly what I thought too bug my final URs generated via your code did not work so I was thinking maybe it was because of that hmm ...

You can check my changes now, they are in our repo already.

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 13:17.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.