Skip to content

Commit d412c1f

Browse files
authored
Merge pull request #3 from yellow/master
Some validations before the connection phase
2 parents 3b25846 + 02ef5a1 commit d412c1f

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

lib/get.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,29 @@
2121

2222
def requestJob(item):
2323
word = words[item]
24-
link = replace(word)
25-
s = requests.Session()
26-
if PROXY() == "True":
27-
plist = PROXYLIST()
28-
i = random.randrange(0, plist.__len__())
29-
sess = ProxyHelper().setProxy(s, plist[i])
30-
r = sess.get(link)
24+
25+
if SITE()==3 and not 4<len(word)<16:
26+
with print_lock:
27+
print("["+threading.current_thread().name+"] "+word+" is UNAVAILABLE on twitter because it has illegal length.")
28+
elif SITE()==10 and not len(word)<40:
29+
with print_lock:
30+
print("["+threading.current_thread().name+"] "+word+" is UNAVAILABLE on github because it has illegal length.")
31+
elif SITE()==13 and not 2<len(word)<21:
32+
with print_lock:
33+
print("["+threading.current_thread().name+"] "+word+" is UNAVAILABLE on pastebin because it has illegal length.")
3134
else:
32-
r = s.get(link)
33-
with print_lock:
34-
log_result(r, word, link)
35+
36+
link = replace(word)
37+
s = requests.Session()
38+
if PROXY() == "True":
39+
plist = PROXYLIST()
40+
i = random.randrange(0, plist.__len__())
41+
sess = ProxyHelper().setProxy(s, plist[i])
42+
r = sess.get(link)
43+
else:
44+
r = s.get(link)
45+
with print_lock:
46+
log_result(r, word, link)
3547

3648
def threader():
3749
while True:

0 commit comments

Comments
 (0)