Skip to content

Commit

Permalink
Merge pull request sherlock-project#841 from h20190563/master
Browse files Browse the repository at this point in the history
Adding facility to support multiple errors
  • Loading branch information
sdushantha committed Nov 5, 2020
2 parents f2af78b + 7e041a4 commit 2606ce1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion sherlock/resources/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,8 @@
"username_unclaimed": "noonewouldeverusethis7"
},
"Tinder": {
"errorMsg": "<title data-react-helmet=\"true\">Tinder | Match. Chat. Date.</title>",
"errorMsg": ["<title data-react-helmet=\"true\">Tinder | Dating, Make Friends &amp; Meet New People</title>",
"<title data-react-helmet=\"true\">Tinder | Match. Chat. Date.</title>"],
"errorType": "message",
"url": "https://www.gotinder.com/@{}",
"urlMain": "https://tinder.com/",
Expand Down
24 changes: 21 additions & 3 deletions sherlock/sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,27 @@ def sherlock(username, site_data, query_notify,
query_time=response_time,
context=error_text)
elif error_type == "message":
error = net_info.get("errorMsg")
# Checks if the error message is in the HTML
if not error in r.text:
# error_flag True denotes no error found in the HTML
# error_flag False denotes error found in the HTML
error_flag = True
errors=net_info.get("errorMsg")
# errors will hold the error message
# it can be string or list
# by insinstance method we can detect that
# and handle the case for strings as normal procedure
# and if its list we can iterate the errors
if isinstance(errors,str):
# Checks if the error message is in the HTML
# if error is present we will set flag to False
if errors in r.text:
error_flag = False
else:
# If it's list, it will iterate all the error message
for error in errors:
if error in r.text:
error_flag = False
break
if error_flag:
result = QueryResult(username,
social_network,
url,
Expand Down

0 comments on commit 2606ce1

Please sign in to comment.