From 15822b887655b8507daee5bf15252118f72af91d Mon Sep 17 00:00:00 2001 From: leca Date: Fri, 17 Feb 2023 21:47:38 +0300 Subject: [PATCH] Script now skip downloaded content --- utilities/rule34.xxx-parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utilities/rule34.xxx-parser.py b/utilities/rule34.xxx-parser.py index 35f4d72..ee72df5 100644 --- a/utilities/rule34.xxx-parser.py +++ b/utilities/rule34.xxx-parser.py @@ -12,6 +12,10 @@ def download_url(url): filename = url.split('/')[-1].replace(" ", "_") path = destination + "/" + filename print("Downloading: " + url + " -> " + path) + if os.path.exists(path): + print("Skipping downloaded content...") + return # skip downloaded content + resp = requests.get(url) open(path, "wb").write(resp.content); @@ -19,7 +23,6 @@ post_count = 0 page = 0 while (not done): - response = requests.get("https://api.rule34.xxx/index.php?page=dapi&s=post&json=1&q=index&tags=" + tags + "&pid=" + str(page) + ""); content = json.loads(response.content) for entry in content: