@@ -66,16 +66,17 @@ def available(word, service, link):
6666 fx .write (link + "\n " )
6767 fx .close ()
6868
69- def log_result (response , word , link , element = None , matches = None ):
69+ def log_result (response , word , link , matches = None ):
7070 service = re .search (DOMAIN , link ).group (1 )
71- if ( matches != None ) or ( element != None ) :
72- if matches :
71+ if matches != None :
72+ if matches [ 0 ] != [] :
7373 available (word , service , link )
74+ elif matches [1 ]:
75+ taken (word , service )
76+ elif matches [2 ]:
77+ taken (word , service )
7478 else :
75- if element :
76- taken (word , service )
77- else :
78- available (word , service , link )
79+ print ("The username " + word + " requires manual verification on " + service + " (" + str (response .status_code ) + ")" )
7980
8081 elif response .status_code == 200 :
8182 if int (SITE ) == 3 : # Twitter
@@ -152,21 +153,33 @@ def parse_page(words):
152153 page = r .content
153154 soup = BeautifulSoup (page , "html.parser" )
154155 matches = []
155- elem = ""
156156 if int (SITE ) == 5 :
157- matches = soup .find_all ("h3" )
158- elem = soup .find ('div' , attrs = {'class' : 'profile_private_info' })
157+ # Available
158+ match1 = soup .body .findAll (text = 'The specified profile could not be found.' )
159+ # Taken
160+ match2 = soup .body .findAll (text = 'This profile is private.' )
161+ match3 = soup .find ('div' , attrs = {'class' : 'profile_header' })
162+
163+ matches = [match1 , match2 , match3 ]
159164 elif int (SITE ) == 6 :
160- matches = soup .find_all ("h3" )
161- elem = soup .find ('div' , attrs = {'class' : 'error_ctn' })
165+ # Available
166+ match1 = soup .body .findAll (text = 'No group could be retrieved for the given URL.' )
167+ # Taken
168+ match2 = soup .body .findAll (text = 'Request To Join' )
169+ match3 = soup .find ('div' , attrs = {'class' : 'grouppage_header' })
170+
171+ matches = [match1 , match2 , match3 ]
162172 elif int (SITE ) == 8 :
163- matches = soup .find_all ("h3" )
164- elem = soup .find ('div' , attrs = {'id' : 'player' })
165- print (matches )
166- print (elem )
173+ # Available
174+ match1 = soup .body .findAll (text = 'Sorry. Unless you\’ve got a time machine, that content is unavailable.' )
175+ # Taken
176+ match2 = soup .find ('div' , attrs = {'id' : 'player' })
177+ match3 = soup .body .findAll (text = 'The community has closed this channel due to terms of service violations.' )
178+
179+ matches = [match1 , match2 , match3 ]
167180 else :
168181 print ("Wrong site!" )
169- log_result (r , words [w ], link , element = elem , matches = matches )
182+ log_result (r , words [w ], link , matches = matches )
170183
171184def send_post (words ):
172185 cookie = get_cookie ()
0 commit comments