-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
39 lines (30 loc) · 868 Bytes
/
main.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
import string
import random
import requests
BASE_URL = 'https://i.imgur.com/'
def get_url():
counter = 0
url_hash = ''
while counter < 5:
random_letter = random.choice(string.ascii_letters)
url_hash += random_letter
counter += 1
return BASE_URL + url_hash + '.jpg'
print('START')
while True:
img_url = get_url()
r = requests.get(img_url + '.jpg')
while r.url == 'https://i.imgur.com/removed.png':
img_url = get_url()
r = requests.get(img_url)
filename = img_url.split("/")[-1]
r = requests.post(
"https://api.deepai.org/api/nsfw-detector",
data={
'image': img_url + '.jpg',
},
headers={'api-key': 'your deepAI api key goes here'}
)
json_response = r.json()
if len(json_response['output']['detections']):
print(img_url)