AlphaSlayer1964 / kemono-dl

A simple kemono.party downloader using python.
509 stars 81 forks source link

%y date bugs out sometimes #85

Closed sybarix closed 2 years ago

sybarix commented 2 years ago

Version

Version: 2022.04.23

Your Command


@echo off
py kemono-dl.py --cookies "kemono.party_cookies.txt,coomer.party_cookies.txt" --kemono-fav-users all --coomer-fav-users all --skip-filetypes PSD --inline --json --extract-links --yt-dlp --dirname-pattern "D:\Storage\Offline\Images\Archivers\DL\{username} [{user_id}] {service}" --filename-pattern "({published}) {index} - {filename} [{id}].{ext}" --date-strf-pattern "%%y/%%m/%%d"
pause

Description of bug

When using %y as one of the arguments for --date-strf-pattern, some posts cause the script to halt.

How To Reproduce

Based on the error message, run the script with %y as one of the arguments for --date-strf-pattern. However, further testing was not yet done to verify if %y is the only cause.

Error messages and tracebacks


ERROR:Unable to get favorite users from kemono.party
Traceback (most recent call last):
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 584, in start_download
    self.get_favorites('kemono', 'artist', self.k_fav_users)
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 124, in get_favorites
    self.get_post(f"https://{site}.party/{favorite['service']}/user/{favorite['id']}")
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 155, in get_post
    post = self.clean_post(post, user, site)
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 303, in clean_post
    clean_post['updated'] = (datetime.datetime.strptime(post['edited'], r'%a, %d %b %Y %H:%M:%S %Z') if post['edited'] else datetime.datetime.min).strftime(self.date_strf_pattern)
ValueError: format %y requires year >= 1900 on Windows
ERROR:Unable to get favorite users from coomer.party
Traceback (most recent call last):
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 589, in start_download
    self.get_favorites('coomer', 'artist', self.c_fav_users)
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 124, in get_favorites
    self.get_post(f"https://{site}.party/{favorite['service']}/user/{favorite['id']}")
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 155, in get_post
    post = self.clean_post(post, user, site)
  File "D:\Storage\Offline\Images\Archivers\kemono-dl-2022.04.23\src\main.py", line 303, in clean_post
    clean_post['updated'] = (datetime.datetime.strptime(post['edited'], r'%a, %d %b %Y %H:%M:%S %Z') if post['edited'] else datetime.datetime.min).strftime(self.date_strf_pattern)
ValueError: format %y requires year >= 1900 on Windows
Press any key to continue . . .

Additionally, using %%y/%%m/%%d should result in 2022/04/23 as the date, but the output is 2022_04_23 (very minor issue).

AlphaSlayer1964 commented 2 years ago

Can you post the post url where that error occurred? I could see this being an issue with Gumraod posts because they have no published date but all posts edited date is the date they were last edited on kemono so they should all be proper dates.

Additionally, using %%y/%%m/%%d should result in 2022/04/23 as the date, but the output is 2022_04_23 (very minor issue).

You can not have slashes in windows file or folder names and all illegal characters are converted to _.

sybarix commented 2 years ago

You can not have slashes in windows file or folder names and all illegal characters are converted to _.

Whoops, totally forgot about that thanks.

Can you post the post url where that error occurred?

(NSFW) https://kemono.party/fanbox/user/11229342/post/1065108

AlphaSlayer1964 commented 2 years ago

Ok ya looks like there is no edited date so it defaults to 00010101 in the current version. I should have a new version out tonight that will just make it the text string None instead.

AlphaSlayer1964 commented 2 years ago

Fixed in release 2022.04.24