-
Notifications
You must be signed in to change notification settings - Fork 0
/
exploit.py
49 lines (30 loc) · 988 Bytes
/
exploit.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
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import re
import urllib
def download(url):
"""Copy the contents of a file from a given URL
to a local file.
"""
webFile = urllib.urlopen(url)
localFile = open(url.split('/')[-1], 'w')
localFile.write(webFile.read())
webFile.close()
localFile.close()
#progfile = open("progress", "w")
file = open("places", "rb")
countries = []
countries = file.readlines()[0].split(",")
for x in range(5354,len(countries)):
#progfile.write(str(x)+"\n")
print "downloading "+countries[x]+" images: place number: "+str(x)
flickr_result = requests.get('https://www.flickr.com/search/?text=' + countries[x]).text.encode('utf-8')
search_ex = re.compile('farm.{40,60}_b.jpg')
rawlinks = search_ex.findall(flickr_result)
#
#print rawlinks[0].replace("\\","")
#print len(plist)
for y in range(0,len(rawlinks)):
try:
download('http://'+rawlinks[y].replace("\\",""))
except:
pass