Script now skip downloaded content

This commit is contained in:
leca 2023-02-17 21:47:38 +03:00
parent 5d2aeb1d5f
commit 15822b8876
1 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,10 @@ def download_url(url):
filename = url.split('/')[-1].replace(" ", "_") filename = url.split('/')[-1].replace(" ", "_")
path = destination + "/" + filename path = destination + "/" + filename
print("Downloading: " + url + " -> " + path) print("Downloading: " + url + " -> " + path)
if os.path.exists(path):
print("Skipping downloaded content...")
return # skip downloaded content
resp = requests.get(url) resp = requests.get(url)
open(path, "wb").write(resp.content); open(path, "wb").write(resp.content);
@ -19,7 +23,6 @@ post_count = 0
page = 0 page = 0
while (not done): 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) + ""); 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) content = json.loads(response.content)
for entry in content: for entry in content: