mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.7k stars 953 forks source link

[Reddit] Media Is Downloaded Twice #4649

Closed ismailnoor819 closed 1 year ago

ismailnoor819 commented 1 year ago

Possibly related to #4470 . It seems so in the latest update of gallery-dl, media is downloaded twice, first a lower resolution version is downloaded from preview.redd.it, this makes it so that the higher quality version is not downloaded due to having the same filename unless it is from an external hosting site such as redgifs or imgur. In that case it does download again in the higher resolution if you have "'_reddit' in locals()": added, which still keeps the problem of having to deal with those duplicate files.

mikf commented 1 year ago

Post an example :)

It works as expected for me with default settings:

$ gallery-dl https://old.reddit.com/r/lavaporn/comments/10f25is/lava_looking_incredibly_smooth_as_it_flows_900x600/
/tmp/_/reddit/lavaporn/10f25is Lava loo…redibly smooth as it flows [900x600].jpg

$ gallery-dl https://old.reddit.com/r/lavaporn/comments/v5bp1g/lava_at_night_4288_1290/
/tmp/_/flickr/Thorology/flickr_4490523929.jpg
ismailnoor819 commented 1 year ago

For sure! I believe it mainly applies to videos, so maybe try something from redgifs or imgur. Here is an example with my verbose log. https://gist.github.com/ismailnoor819/370f5467d6ca005fd49b545071398a0b

ismailnoor819 commented 1 year ago

Another example : https://gist.github.com/ismailnoor819/a1f5f152933edf79b0a86c14721b37c6 FYI should have mentioned before but both are NSFW

ismailnoor819 commented 1 year ago

Perhaps we could separate the preview.redd.it files separately somehow? Maybe via folder or filename so I could identify them and delete the ones that are also hosted on redgifs. What do you think? @mikf

mikf commented 1 year ago

Fixed in https://github.com/mikf/gallery-dl/commit/8bb7243c1020c07108064ba1b950ac941fe0c376. The problem was a wrong fallback URL for URLs from comments. In your examples it tries to download gfycat animations found in a comment, fails, and uses the preview from the main submission as fallback.