better path handling
This commit is contained in:
parent
fb8baf35f4
commit
f197c47a06
@ -21,8 +21,8 @@ def get_timestamp_of_file(file):
|
|||||||
def album(id):
|
def album(id):
|
||||||
req = IMAGE_CACHE
|
req = IMAGE_CACHE
|
||||||
|
|
||||||
get("/a/" + id, req)
|
get("a/" + id, req)
|
||||||
found_list_file = IMAGE_CACHE + ("/a/" + id).replace('/', '_')
|
found_list_file = IMAGE_CACHE + ("a/" + id).replace('/', '_')
|
||||||
|
|
||||||
with open(found_list_file, 'r') as f:
|
with open(found_list_file, 'r') as f:
|
||||||
imgs = f.read().split(',')
|
imgs = f.read().split(',')
|
||||||
|
@ -25,15 +25,13 @@ def error(msg):
|
|||||||
def get(url: str, write_dir: str, delete=True):
|
def get(url: str, write_dir: str, delete=True):
|
||||||
orig_url = url
|
orig_url = url
|
||||||
if not url.startswith('https://imgur.com/'):
|
if not url.startswith('https://imgur.com/'):
|
||||||
url = 'https://imgur.com' + url
|
|
||||||
found_url = ''
|
found_url = ''
|
||||||
found_urls = []
|
found_urls = []
|
||||||
found_list_file = ''
|
found_list_file = ''
|
||||||
|
url = 'https://imgur.com/' + url
|
||||||
|
|
||||||
album = False
|
album = False
|
||||||
if "gallery" in url:
|
if url.startswith("https://imgur.com/a/"):
|
||||||
url = url.replace("gallery", "a")
|
|
||||||
if "/a/" in url:
|
|
||||||
album = True
|
album = True
|
||||||
if not url.endswith("blog"):
|
if not url.endswith("blog"):
|
||||||
url += "/layout/blog"
|
url += "/layout/blog"
|
||||||
|
Loading…
Reference in New Issue
Block a user