diff --git a/imgin/__init__.py b/imgin/__init__.py index 85f6cbd..b38d032 100644 --- a/imgin/__init__.py +++ b/imgin/__init__.py @@ -21,8 +21,8 @@ def get_timestamp_of_file(file): def album(id): req = IMAGE_CACHE - get("/a/" + id, req) - found_list_file = IMAGE_CACHE + ("/a/" + id).replace('/', '_') + get("a/" + id, req) + found_list_file = IMAGE_CACHE + ("a/" + id).replace('/', '_') with open(found_list_file, 'r') as f: imgs = f.read().split(',') diff --git a/imgin/get.py b/imgin/get.py index 7eb1f69..4b05bea 100644 --- a/imgin/get.py +++ b/imgin/get.py @@ -25,15 +25,13 @@ def error(msg): def get(url: str, write_dir: str, delete=True): orig_url = url if not url.startswith('https://imgur.com/'): - url = 'https://imgur.com' + url found_url = '' found_urls = [] found_list_file = '' + url = 'https://imgur.com/' + url album = False - if "gallery" in url: - url = url.replace("gallery", "a") - if "/a/" in url: + if url.startswith("https://imgur.com/a/"): album = True if not url.endswith("blog"): url += "/layout/blog"