mikf / gallery-dl

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

[reddit] Filename rules are not always followed #3837

Open rEnr3n opened 1 year ago

rEnr3n commented 1 year ago

Using simulate, the filename keyword is used right but the extension is wrong.

$ gallery-dl -s -o filename="{filename}.{extension}" https://www.reddit.com/r/twice/comments/szmcrr/220218_mina_rollin_in_oakland/
061yhxbw6mj81.jpg
$ gallery-dl -s -o filename="{filename}.{extension}" https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/
6go5ima9wij81.jpg

If I download the file, one of the links has wrong filename while the other has it right.

$ gallery-dl -v -o filename="{filename}.{extension}" https://www.reddit.com/r/twice/comments/szmcrr/220218_mina_rollin_in_oakland/
[gallery-dl][debug] Version 1.25.1
[gallery-dl][debug] Python 3.10.10 - Linux-6.2.8-arch1-1-x86_64-with-glibc2.37
[gallery-dl][debug] requests 2.28.2 - urllib3 1.26.13
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting DownloadJob for 'https://www.reddit.com/r/twice/comments/szmcrr/220218_mina_rollin_in_oakland/'
[reddit][debug] Using RedditSubmissionExtractor for 'https://www.reddit.com/r/twice/comments/szmcrr/220218_mina_rollin_in_oakland/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): oauth.reddit.com:443
[urllib3.connectionpool][debug] https://oauth.reddit.com:443 "GET /comments/szmcrr/.json?limit=0&raw_json=1 HTTP/1.1" 200 4292
[downloader.ytdl][debug] [generic] Extracting URL: https://v.redd.it/061yhxbw6mj81
[downloader.ytdl][debug] [generic] 061yhxbw6mj81: Downloading webpage
[downloader.ytdl][debug] [redirect] Following redirect to https://www.reddit.com/r/twice/comments/szmcrr/220218_mina_rollin_in_oakland/
[downloader.ytdl][debug] [Reddit] Extracting URL: https://www.reddit.com/r/twice/comments/szmcrr/220218_mina_rollin_in_oakland/
[downloader.ytdl][debug] [Reddit] szmcrr: Downloading JSON metadata
[downloader.ytdl][debug] [Reddit] szmcrr: Downloading m3u8 information
[downloader.ytdl][debug] [Reddit] szmcrr: Downloading MPD manifest
./gallery-dl/reddit/twice/DASH_1080.mp4
$ gallery-dl -v -o filename="{filename}.{extension}" https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/
[gallery-dl][debug] Version 1.25.1
[gallery-dl][debug] Python 3.10.10 - Linux-6.2.8-arch1-1-x86_64-with-glibc2.37
[gallery-dl][debug] requests 2.28.2 - urllib3 1.26.13
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting DownloadJob for 'https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/'
[reddit][debug] Using RedditSubmissionExtractor for 'https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): oauth.reddit.com:443
[urllib3.connectionpool][debug] https://oauth.reddit.com:443 "GET /comments/sza10g/.json?limit=0&raw_json=1 HTTP/1.1" 200 4471
[downloader.ytdl][debug] [generic] Extracting URL: https://v.redd.it/6go5ima9wij81
[downloader.ytdl][debug] [generic] 6go5ima9wij81: Downloading webpage
[downloader.ytdl][debug] [redirect] Following redirect to https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/
[downloader.ytdl][debug] [Reddit] Extracting URL: https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/
[downloader.ytdl][debug] [Reddit] sza10g: Downloading JSON metadata
[downloader.ytdl][debug] [Reddit] sza10g: Downloading m3u8 information
[downloader.ytdl][debug] [Reddit] sza10g: Downloading MPD manifest
./gallery-dl/reddit/MyouiMina/6go5ima9wij81.mp4
rEnr3n commented 1 year ago

extension is also empty when listing keywords.

$ gallery-dl -K https://www.reddit.com/r/MyouiMina/comments/sza10g/220218_myoui_sharon_mina_rollin_in_oakland/ | grep -A1 extension
all_awardings[N]['days_of_drip_extension']
  None
--
all_awardings[N]['days_of_drip_extension']
  None
--
extension
mikf commented 1 year ago

Using simulate, the filename keyword is used right but the extension is wrong.

That's expected behavior. For some files, the (correct) filename extension is only known when actually downloading it, which does not happen with --simulate.

extension is also empty when listing keywords.

That's mentioned in the docs.

Note: Even if the value of the extension key is missing or None, it will be filled in later when the file download is starting. This key is therefore always available to provide a valid filename extension.