-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgetimages.py
31 lines (27 loc) · 877 Bytes
/
getimages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import urllib
import re
import time
regexRule = "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
extension = ".jpg"
liked = ""
round = ""
roundIdentifier = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
with open("liked", "r") as text_file:
liked = text_file.read()
with open("identifier.txt", "r") as text_file:
round = text_file.read()
if round == "":
round = "A"
folder = "ladies/"
counter = 0
name = folder + str(counter)
links = re.findall(regexRule, liked)
for link in links:
urllib.urlretrieve(link, folder+link[27:51]+extension)
counter+=1
name = folder + str(counter)+round+extension
#old method of differentiating between round of AI predictions
open("identifier.txt", "w").close()
if (round != "Z"):
with open("identifier.txt", "w") as text_file:
text_file.write(roundIdentifier[roundIdentifier.index(round)+1])