JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 18.02.2025, 17:14
globus999 globus999 is offline
Mega Loader
 
Join Date: May 2011
Posts: 63
Default The old WEBP vs JPG issue

Yes, I know. This has been discussed before... kind of. But, there isn't a general solution to the problem.
This is the issue: There are a large number of websites that *do not* have JD2 plugins (that could be setup to prefer JPG over WEBP).
So, JD2 downloads WEBP. This is a problem because a large number of image viewers do not support WEBP.
But, it gets worse.
There are many sites (again, without plugins) that will be indexed by LinkGrabber correctly. The files it lists in JD2 are JPG. However, once the links are passed to Downloads and the download process begins, the JPG links are converted into WEPB in real-time and downloaded as WEPB.
I am at a loss here.
And yes, I can convert WEPB into JPG using third party software and/or creating Batch files for JD2 to post-execute and change format. BUT, why bother going through all that if JD2 could just download the correct format in the fist place?

Example:
**External links are only visible to Support Staff****External links are only visible to Support Staff**

Tx for a great app!
Reply With Quote
  #2  
Old 18.02.2025, 17:39
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 74,401
Default

Quote:
Originally Posted by globus999 View Post
Yes, I know. This has been discussed before
Where?
Please provide a link for context.

Quote:
Originally Posted by globus999 View Post
There are a large number of websites that *do not* have JD2 plugins (that could be setup to prefer JPG over WEBP).
So, JD2 downloads WEBP.
That is wrong.
If there is no plugin available for a website, JD prefers no specific format but downloads everything.
If you get webp-only for such websites, either our parser is broken or this is the only format the website(s) provide.
I can't help with this without example URLs.

Quote:
Originally Posted by globus999 View Post
However, once the links are passed to Downloads and the download process begins, the JPG links are converted into WEPB in real-time and downloaded as WEPB.
Also wrong:
JD only converts files in very very very rare cases (e.g. YT downloads).
What you describe is most likely the following scenario (again I can't be 100% sure since you did not provide any examples):
1. JD checks links of a particular website and the website says "this file has '<filename>.jpg'".
Now once the download is started, that website returns a header of a different content-type (the "real" file type) so JD corrects the extension just before the download is started.
The changing extension you see is only the text inside the file name - a conversion is not happening!
Your browser will do the same thing.
Example:
imagecache.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/92cfe628-70b8-42ec-a8ad-e451f23ff100/width=1280/00193-3556647833.png
-> According to the file name in the link, this is a png file but according to the header, it is a jpeg file. JDownloader will download this file as .jpg/.jpeg file and so does your browser.

Quote:
Originally Posted by globus999 View Post
BUT, why bother going through all that if JD2 could just download the correct format in the fist place?
I'm sorry to tell you but your case of "nhentai.net" is the same.
Here is what technically happens:
1. You add an nhentai gallery link like nhentai.net/g/123456/
2. The crawler wants to provide a nice usability and you expect the links to appear in your linkgrabber very fast so links are not checked one by one at this stage but the crawler just returns "hey I found 40 image links that are online and should have file names XY".
It sets ".jpg" as [temporary] file extension which is sometimes correct, sometimes not (see explanation down below).
3. Now when the download is started later on or when a single linkcheck is initiated, the file extension will be corrected to the real one. A conversion does not happen!
From your example:
Code:
nhentai.net/g/556944/1/
Direct URL to image:
Code:
i2.nhentai.net/galleries/3242990/1.webp
Looks like nhentai.net sometimes provides jpg images and sometimes provides .webp images.
Example where nhentai provides .jpg images:
Example:
Code:
nhentai.net/g/123456/1/
Direct URL to image:
Code:
i4.nhentai.net/galleries/770283/1.jpg
As you can see, the fault is not on JDownloaders' side in fact everything works as intended.

Quote:
Originally Posted by globus999 View Post
And yes, I can convert WEPB into JPG using third party software and/or creating Batch files for JD2 to post-execute and change format.
This is exactly what you will need to do.
You can even do this inside JDownloader using an EventScripter script.
EventScripter subforum:
https://board.jdownloader.org/forumdisplay.php?f=52
EventScripter help article:
https://support.jdownloader.org/know...event-scripter


Alternatively, feel free to contact the nhentai.net support and ask them to provide the images in both .jpg and .webp formats.

Quote:
Originally Posted by globus999 View Post
Tx for a great app!
Thanks!
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?

Last edited by pspzockerscene; 18.02.2025 at 17:51. Reason: Improved readability; added thanks
Reply With Quote
  #3  
Old 18.02.2025, 17:59
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 74,401
Default

Addendum, specifically about the nhentai.net crawler:
I just found out that there is indeed a way to find the final file extension right away since the thumbnails of the images are in the same format as the full size images.
Now this will not "fix" your problem but this will change the behavior in a way that the names you see in the linkgrabber will be the final names already e.g. the .webp images will have the correct .webp file extension right away.

The update has just been released and only affects items added after installing the update.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #4  
Old 18.02.2025, 18:10
globus999 globus999 is offline
Mega Loader
 
Join Date: May 2011
Posts: 63
Default

Quote:
Originally Posted by pspzockerscene View Post
Where?
Please provide a link for context.
As requested:
https://board.jdownloader.org/showthread.php?t=96085
https://board.jdownloader.org/showthread.php?t=83015


Quote:
That is wrong.
If there is no plugin available for a website, JD prefers no specific format but downloads everything.
I never said it did. I said that it should do so.

Quote:
If you get webp-only for such websites, either our parser is broken or this is the only format the website(s) provide.
I can't help with this without example URLs.
Link was provided.

Quote:
Also wrong:
JD only converts files in very very very rare cases (e.g. YT downloads).
What you describe is most likely the following scenario (again I can't be 100% sure since you did not provide any examples):
I *did not* request an auto conversion. I know this is (mostly) outside JD2's scope.

Quote:
1. JD checks links of a particular website and the website says "this file has '<filename>.jpg'".
Now once the download is started, that website returns a header of a different content-type (the "real" file type) so JD corrects the extension just before the download is started.
The changing extension you see is only the text inside the file name - a conversion is not happening!
Your browser will do the same thing.
OK, but I *do not* know how JD2 works internally. There is no specific document explaining this. That's why I posted here.

Quote:
Example:
imagecache.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/92cfe628-70b8-42ec-a8ad-e451f23ff100/width=1280/00193-3556647833.png
-> According to the file name in the link, this is a png file but according to the header, it is a jpeg file. JDownloader will download this file as .jpg/.jpeg file and so does your browser.
Yes, I see. But, your browser analogy is not correct, as the function of a browser is to render pictures while hiding underlying formatting/complexity issues. As such a browser is agnostic to format as long as it can be rendered. The function of JD2 is to download files with a specific characteristic or format (subject to availability). Said characteristics and/or formats are *not* the same (again, subject to user's purpose).

Quote:
I'm sorry to tell you but your case of "nhentai.net" is the same.
Here is what technically happens:
1. You add an nhentai gallery link like nhentai.net/g/123456/
2. The crawler wants to provide a nice usability and you expect the links to appear in your linkgrabber very fast so links are not checked one by one at this stage but the crawler just returns "hey I found 40 image links that are online and should have file names XY".
It sets ".jpg" as [temporary] file extension which is sometimes correct, sometimes not (see explanation down below).
3. Now when the download is started later on or when a single linkcheck is initiated, the file extension will be corrected to the real one. A conversion does not happen!
From your example:
Code:
nhentai.net/g/556944/1/
Code:
i2.nhentai.net/galleries/3242990/1.webp
Got it. Tx.

Quote:
Looks like nhentai.net sometimes provides jpg images and sometimes provides .webp images.
Example where nhentai provides .jpg images:
Example:
Code:
nhentai.net/g/123456/1/
Direct URL to image:
Code:
i4.nhentai.net/galleries/770283/1.jpg
This seems correct and a website defect. Of course, this would not affect a browser but it does affect file formats downloaded by JD2.

Quote:
As you can see, the fault is not on JDownloaders' side in fact everything works as intended.
Yes. You are right. But, pursuant to my previous statement, there was no previous documentation explaining this. And, unfortunately, I *know* that just documenting JD2 programming logic is a herculean task with little to now gain. Not to mention that as JD2 goes through constant changes and in order to catch-up with said changes would require a team. This effort is pointless. FYI: I am *not* talking about code commenting, I am talking about URS, SRD, and DRS - type documents (i.e. Software Engineering / Lifecycle).

Quote:
This is exactly what you will need to do.
You can even do this inside JDownloader using an EventScripter script.
EventScripter subforum:
**External links are only visible to Support Staff**...
EventScripter help article:
**External links are only visible to Support Staff**...
I am aware of this functionality, but, in all honesty, I have used it very little. Partially because most command line programs I use are dependent upon a different interface, which is not that easy to code in a batch-type file or command line. Take for example Cygwin. Sure, it is possible (not saying it isn't) but it is a pain-in-the-neck.

Quote:
Alternatively, feel free to contact the nhentai.net support and ask them to provide the images in both .jpg and .webp formats.
This is a non-starter. This site is just an example of the problem. There are many, many other sites that do the same. What you are proposing is to, basically, e-mail about half of the Internet

Anyhow, thanks for taking the time to explain.

Max
Reply With Quote
  #5  
Old 18.02.2025, 18:43
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 74,401
Default

Quote:
Originally Posted by globus999 View Post
As requested:
Thanks though I see two unrelated threads there.
One is for a seemingly unsupported website where the user did not even provide example links.
The 2nd thread is about "hitomi.la" which we support via plugin.
That website provides multiple possible image formats so back then we've added a setting.
Your case is different: nhentai.net only has one format and it can be either .jpg or .webp.

Quote:
Originally Posted by globus999 View Post
I said that it should do so.
Got it.
You can do this using EventScripter scripts and/or filters.
The thing for "unsupported" websites is:
JD cannot know that two links to a file with the same name but different extension really lead to the same file thus just eliminating one file-type is prone to error.
I recommend using filters and/or customized linkgrabber views.
See Settings -> Linkgrabber filter
If you know the website well enough, you could also combine this with an EventScripter script that removes unwanted formats for specific websites.

Quote:
Originally Posted by globus999 View Post
Link was provided.
The link you provided was going to a website supported via plugin while you were [also] talking about unsupported websites.

Quote:
Originally Posted by globus999 View Post
I *did not* request an auto conversion. I know this is (mostly) outside JD2's scope.
From what I understood, you though JD would already be doing a conversion.
All I wanted to say was: JD is not doing a conversion.

Quote:
Originally Posted by globus999 View Post
OK, but I *do not* know how JD2 works internally. There is no specific document explaining this. That's why I posted here.
You don't need to know how JD works for checking this scenario:
Just open those links in your browser -> Rightclick on an image -> Save to -> And you will get .webp files just like in JDownloader.

Quote:
Originally Posted by globus999 View Post
But, your browser analogy is not correct[...]
Wrong since I was solely talking about the "single-file-download-part" which works very similar in JD and browser:
The browser prefers the content-type from the header [or even from the file itself] over the file-extension given inside that URL(!)
You can even see your browser correcting the file name froim the URL, exactly like JD does:
Takes this part from the URL: 00193-3556647833.png
-> Corrects it to: 00193-3556647833.jpeg
If the URL had no usable file name, you brower (and also JDownloader) would fall back to another part of the URL and use that as file name and append the correct file extension.

Quote:
Originally Posted by globus999 View Post
This seems correct and a website defect.
You can't know this for sure unless you contact the nhentai.net support and ask them if this is intended.
If you do so, please let me know what they replied.

Quote:
Originally Posted by globus999 View Post
there was no previous documentation explaining this
Yap and there won't ever be one.
Though if you look for a documentation on how browsers decide why names of downloaded files look like they look, you most likely won't find a documentation either.
Anyways, maybe my reply is enough documentation for you for this specific topic^^

Quote:
Originally Posted by globus999 View Post
Partially because most command line programs I use are dependent upon a different interface, which is not that easy to code in a batch-type file or command line.
Tbh with todays' tools like ChatGPT and other webtools you should be able to get something working.
If not, you can still ask other users here to help you.
Just as an unrelated example, even without ChatGPT:
People built websites that can be used to create FFmpeg commands in an easy way to convert media files:
Example 1:
alfg.dev/ffmpeg-commander/
Example 2:
ffmpeg.lav.io/

Doing a very quick research, FFmpeg should even be able to convert images, see:
superuser.com/questions/606800/converting-image-format-to-jpeg-using-ffmpeg

Quote:
Originally Posted by globus999 View Post
This site is just an example of the problem.
Feel free to provide further examples for other websites with "the same problem".

Though tbh your problem is very very easy to solve with a simple "convert webp to jpg" EventScripter script.
In our EventScripter subforum there are already scripts that use FFmpeg for conversion.
Changing them to do the image conversion shouldn't be a big deal.
Also your problem is "unsolvable" since, as you already recognized correctly, asking different website admins to provide their images in your desired format is pointless and time-intensive.
Example:
https://board.jdownloader.org/showthread.php?t=96728

Quote:
Originally Posted by globus999 View Post
Anyhow, thanks for taking the time to explain.
No worries.
Feel free to ask if you got more questions.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #6  
Old 18.02.2025, 19:07
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 74,401
Default

To prove my point, I just took the mentioned "convert to mp3" script and used ChatGPT zu modify it to convert webp images to jpg images.
I've literally only changed a single line of code by hand in the end.

Link to the script:
https://board.jdownloader.org/showthread.php?t=97079

I've tested it with your nhentai example link and all 48 images were successfully converted to .jpg.

Here is the prompt I sent to ChatGPT:
Code:
Modify the following script as follows:

It should convert .webp image files to .jpg without quality loss.
Remove all irrelevant code related to videos or bitrates.
Side notes:
If I had written this script for myself, I'd polish it a bit more but those are really only minor cosmetic things.
Here is what could be better:
- Files in the JDownloader downloadlist are not renamed, they will be listed as ".webp" even after the conversion
- If FFmpeg is not available, this script may error out with a cryptic error message
- Finding the file extension looks a bit sketchy to me so I'd try to improve that.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?

Last edited by pspzockerscene; 18.02.2025 at 19:12. Reason: Fixed typo
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 15:50.
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 - 2025, Jelsoft Enterprises Ltd.