diff --git a/main.py b/main.py index f9d415c..b08e821 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import os import json import aiohttp import pprint @@ -187,6 +188,7 @@ async def download_images(ctx): log.info("processing post %r", md5) existing_post = await fetch_post(ctx, md5) if existing_post: + log.info("already exists %r", md5) continue # download the post @@ -194,10 +196,10 @@ async def download_images(ctx): post_url_path = Path(urlparse(post_file_url).path) good_extension = False for extension in ALLOWED_EXTENSIONS: - if extension in post_url_path.stem: + if extension in post_url_path.suffix: good_extension = True if not good_extension: - log.info("ignoring %r, invalid extension (%r)", md5, post_url_path.stem) + log.info("ignoring %r, invalid extension (%r)", md5, post_url_path.suffix) continue post_filename = post_url_path.name post_filepath = DOWNLOADS / post_filename