From 41a44be6cd9b5e1f154c2e726f0d9f1a4a6a96a3 Mon Sep 17 00:00:00 2001 From: Siddharth Dushantha Date: Wed, 26 Dec 2018 13:29:26 +0100 Subject: [PATCH] fixed issue #9 --- .gitignore | 2 +- data.json | 30 ++++++++++++++++++++---------- sherlock.py | 7 ++++++- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 709c0480..753dfef7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ # Jupyter Notebook .ipynb_checkpoints -.ipynb +*.ipynb diff --git a/data.json b/data.json index a8d9d55e..627d0df8 100644 --- a/data.json +++ b/data.json @@ -20,7 +20,8 @@ }, "Blogger": { "url": "https://{}.blogspot.com", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "Google Plus": { "url": "https://plus.google.com/+{}", @@ -38,7 +39,8 @@ }, "GitHub": { "url": "https://www.github.com/{}", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "Steam": { "url": "https://steamcommunity.com/id/{}", @@ -64,7 +66,8 @@ }, "DeviantART": { "url": "https://{}.deviantart.com", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "VK": { "url": "https://vk.com/{}", @@ -161,12 +164,14 @@ "Kongregate": { "url": "https://www.kongregate.com/accounts/{}", "errorType": "message", - "errorMsg": "Sorry, no account with that name was found." + "errorMsg": "Sorry, no account with that name was found.", + "noPeriod": "True" }, "LiveJournal": { "url": "https://{}.livejournal.com", "errorType": "message", - "errorMsg": "Unknown Journal" + "errorMsg": "Unknown Journal", + "noPeriod": "True" }, "VSCO": { "url": "https://vsco.co/{}", @@ -185,7 +190,8 @@ "Dribbble": { "url": "https://dribbble.com/{}", "errorType": "message", - "errorMsg": "Whoops, that page is gone." + "errorMsg": "Whoops, that page is gone.", + "noPeriod": "True" }, "Codecademy": { "url": "https://www.codecademy.com/{}", @@ -208,7 +214,8 @@ }, "Newgrounds": { "url": "https://{}.newgrounds.com", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "Wattpad": { "url": "https://www.wattpad.com/user/{}", @@ -243,7 +250,8 @@ "Contently": { "url": "https://{}.contently.com/", "errorType": "message", - "errorMsg": "We can't find that page!" + "errorMsg": "We can't find that page!", + "noPeriod": "True" }, "Houzz": { "url": "https://houzz.com/user/{}", @@ -302,7 +310,8 @@ }, "Slack": { "url": "https://{}.slack.com", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "Trip": { "url": "https://www.trip.skyscanner.com/user/{}", @@ -336,7 +345,8 @@ "WordPress": { "url": "https://{}.wordpress.com", "errorType": "response_url", - "errorUrl": "wordpress.com/typo/?subdomain=" + "errorUrl": "wordpress.com/typo/?subdomain=", + "noPeriod": "True" }, "Unsplash": { "url": "https://unsplash.com/@{}", diff --git a/sherlock.py b/sherlock.py index 92fca5fd..3f17b01f 100644 --- a/sherlock.py +++ b/sherlock.py @@ -45,7 +45,12 @@ def main(): for social_network in data: url = data.get(social_network).get("url").format(username) error_type = data.get(social_network).get("errorType") - + + cant_have_period = data.get(social_network).get("noPeriod") + + if cant_have_period == "True": + print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Not Found!".format(social_network)) + continue r = requests.get(url, headers=headers)