Error with date when running with --update-posts on a post already downloaded.
How To Reproduce
Download post linked.
Run again with --update-posts.
Error messages and tracebacks
INFO: Post: アーケードダヴィンチちゃんバックハメ-高画質版
Traceback (most recent call last):
File "/home/freebox/kemono-dl-2021.12.30.01/kemono-dl.py", line 4, in <module>
main()
File "/home/freebox/kemono-dl-2021.12.30.01/src/main.py", line 610, in main
D.download_posts()
File "/home/freebox/kemono-dl-2021.12.30.01/src/main.py", line 159, in download_posts
if self._should_download():
File "/home/freebox/kemono-dl-2021.12.30.01/src/main.py", line 207, in _should_download
current_post_date = datetime.datetime.strptime(self.current_post['edited'], r'%a, %d %b %Y %H:%M:%S %Z')
TypeError: strptime() argument 1 must be str, not None
Additional comments
Happens with the posts that return "null" in the edited field of the json.
Quick fix
Not a good looking fix but it works for those who want to fix it asap.
In main.py l.205
with open(json_path, 'r') as f:
data = json.loads(f.read())
# Check if remote edit is null. If it is, logs that we cannot verify the date.
if data['edited'] is None:
logger.info("Cannot verify if post has been updated.")
return False
# Check if local edit is null while the remote isn't. It just skips the next part checking the dates.
elif self.current_post['edited'] is None:
logger.info("Updating post.")
else:
current_post_date = datetime.datetime.strptime(self.current_post['edited'], r'%a, %d %b %Y %H:%M:%S %Z')
old_post_date = datetime.datetime.strptime(data['edited'], r'%a, %d %b %Y %H:%M:%S %Z')
if old_post_date > current_post_date:
logger.info("Skipping Post: Post is up to date")
return False
Version
Version: 2021.12.30.01
Site, Service, User ID, Post ID
Your Command
Description of bug
Error with date when running with --update-posts on a post already downloaded.
How To Reproduce
Error messages and tracebacks
Additional comments
Happens with the posts that return "null" in the edited field of the json.
Quick fix
Not a good looking fix but it works for those who want to fix it asap.
In main.py l.205