mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 06:29:54 -05:00
commit
c68b8f3ef9
89
sopel_modules/SpiceBot/Sherlock.py
Normal file
89
sopel_modules/SpiceBot/Sherlock.py
Normal file
@ -0,0 +1,89 @@
|
||||
# coding=utf8
|
||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||
"""A way to search google"""
|
||||
|
||||
import sopel_modules
|
||||
|
||||
from .Tools import read_directory_json_to_dict
|
||||
|
||||
import os
|
||||
from fake_useragent import UserAgent
|
||||
import requests
|
||||
import time
|
||||
|
||||
|
||||
class Sherlock():
|
||||
|
||||
def __init__(self):
|
||||
self.header = {'User-Agent': str(UserAgent().chrome)}
|
||||
self.dict = {}
|
||||
|
||||
dir_to_scan = []
|
||||
for plugin_dir in set(sopel_modules.__path__):
|
||||
configsdir = os.path.join(plugin_dir, "SpiceBot_Configs")
|
||||
usercfgdir = os.path.join(configsdir, "sherlock")
|
||||
dir_to_scan.append(usercfgdir)
|
||||
|
||||
valid_usernames_dict = read_directory_json_to_dict(dir_to_scan, "Gif API", "SpiceBot_Gif")
|
||||
|
||||
for social_network in list(valid_usernames_dict.keys()):
|
||||
self.dict[social_network] = valid_usernames_dict[social_network]
|
||||
self.dict[social_network]["cache"] = dict()
|
||||
|
||||
def check_network(self, username, social_network):
|
||||
|
||||
if username in list(self.dict[social_network]["cache"].keys()):
|
||||
if time.time() - self.dict[social_network]["cache"][username]["time"] <= 1800:
|
||||
return self.dict[social_network]["cache"][username]["exists"]
|
||||
|
||||
url = self.dict.get(social_network).get("url").format(username)
|
||||
error_type = self.dict.get(social_network).get("errorType")
|
||||
cant_have_period = self.dict.get(social_network).get("noPeriod")
|
||||
|
||||
if ("." in username) and (cant_have_period == "True"):
|
||||
while ("." in username):
|
||||
username = username.replace(".", '')
|
||||
|
||||
r, error_type = self.make_request(url=url, error_type=error_type, social_network=social_network)
|
||||
|
||||
user_exists = False
|
||||
|
||||
if error_type == "message":
|
||||
error = self.dict.get(social_network).get("errorMsg")
|
||||
# Checks if the error message is in the HTML
|
||||
if error not in r.text:
|
||||
user_exists = True
|
||||
|
||||
elif error_type == "status_code":
|
||||
# Checks if the status code of the repsonse is 404
|
||||
if not r.status_code == 404:
|
||||
user_exists = True
|
||||
|
||||
elif error_type == "response_url":
|
||||
error = self.dict.get(social_network).get("errorUrl")
|
||||
# Checks if the redirect url is the same as the one defined in data.json
|
||||
if error not in r.url:
|
||||
user_exists = True
|
||||
|
||||
self.dict[social_network]["cache"][username] = {
|
||||
"time": time.time(),
|
||||
"exists": user_exists
|
||||
}
|
||||
|
||||
if user_exists:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def make_request(self, url, error_type, social_network):
|
||||
try:
|
||||
r = requests.get(url, headers=self.header)
|
||||
if r.status_code:
|
||||
return r, error_type
|
||||
except Exception as e:
|
||||
returnval = e
|
||||
returnval = None
|
||||
return returnval, ""
|
||||
|
||||
|
||||
sherlock = Sherlock()
|
||||
@ -333,7 +333,7 @@ def read_directory_json_to_dict(directories, configtypename="Config File", log_f
|
||||
if len(os.listdir(directory)) > 0:
|
||||
for file in os.listdir(directory):
|
||||
filepath = os.path.join(directory, file)
|
||||
if os.path.isfile(filepath):
|
||||
if os.path.isfile(filepath) and filepath.endswith('.json'):
|
||||
filesprocess.append(filepath)
|
||||
|
||||
for filepath in filesprocess:
|
||||
@ -356,7 +356,8 @@ def read_directory_json_to_dict(directories, configtypename="Config File", log_f
|
||||
filecount += 1
|
||||
slashsplit = str(filepath).split("/")
|
||||
filename = slashsplit[-1]
|
||||
configs_dict[filename] = dict_from_file
|
||||
filename_base = os.path.basename(filename).rsplit('.', 1)[0]
|
||||
configs_dict[filename_base] = dict_from_file
|
||||
else:
|
||||
fileopenfail += 1
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ from .Users import *
|
||||
from .AI import *
|
||||
from .Google import *
|
||||
from .Gif import *
|
||||
from .Sherlock import *
|
||||
|
||||
|
||||
from .configure import *
|
||||
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/500px.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/500px.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://500px.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Sorry, no such page."
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/About.me.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/About.me.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://about.me/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/AngelList.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/AngelList.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://angel.co/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "We couldn't find what you were looking for."
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/BLIP.fm.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/BLIP.fm.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://blip.fm/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page Not Found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Bandcamp.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Bandcamp.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.bandcamp.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Sorry, that something isn’t here"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Behance.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Behance.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.behance.net/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Oops! We can’t find that page."
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/BitBucket.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/BitBucket.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://bitbucket.org/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Blogger.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Blogger.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://{}.blogspot.com",
|
||||
"errorType": "status_code",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/BuzzFeed.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/BuzzFeed.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://buzzfeed.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "We can't find the page you're looking for."
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Canva.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Canva.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.canva.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Not found (404)"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/CashMe.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/CashMe.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://cash.me/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Codecademy.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Codecademy.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.codecademy.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "404 error"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Codementor.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Codementor.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.codementor.io/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "404"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.colourlovers.com/love/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page Not Loved"
|
||||
}
|
||||
6
sopel_modules/SpiceBot_Configs/sherlock/Contently.json
Normal file
6
sopel_modules/SpiceBot_Configs/sherlock/Contently.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"url": "https://{}.contently.com/",
|
||||
"errorType": "message",
|
||||
"errorMsg": "We can't find that page!",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
6
sopel_modules/SpiceBot_Configs/sherlock/DailyMotion.json
Normal file
6
sopel_modules/SpiceBot_Configs/sherlock/DailyMotion.json
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
{
|
||||
"url": "https://www.dailymotion.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page not found"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.designspiration.net/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Content Not Found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/DeviantART.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/DeviantART.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://{}.deviantart.com",
|
||||
"errorType": "status_code",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Disqus.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Disqus.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://disqus.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
6
sopel_modules/SpiceBot_Configs/sherlock/Dribbble.json
Normal file
6
sopel_modules/SpiceBot_Configs/sherlock/Dribbble.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"url": "https://dribbble.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Whoops, that page is gone.",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Ebay.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Ebay.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.ebay.com/usr/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "The User ID you entered was not found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Ello.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Ello.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://ello.co/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "We couldn't find the page you're looking for"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Etsy.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Etsy.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://www.etsy.com/shop/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Facebook.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Facebook.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://www.facebook.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Flickr.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Flickr.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://www.flickr.com/people/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Flipboard.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Flipboard.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://flipboard.com/@{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "loading"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Fotolog.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Fotolog.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://fotolog.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Foursquare.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Foursquare.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://foursquare.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/GitHub.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/GitHub.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.github.com/{}",
|
||||
"errorType": "status_code",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/GoodReads.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/GoodReads.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://www.goodreads.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/GooglePlus.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/GooglePlus.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://plus.google.com/+{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Gravatar.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Gravatar.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "http://en.gravatar.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Gumroad.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Gumroad.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.gumroad.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page not found."
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/HackerNews.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/HackerNews.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://news.ycombinator.com/user?id={}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "No such user."
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/HackerOne.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/HackerOne.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://hackerone.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page not found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Houzz.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Houzz.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://houzz.com/user/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "The page you requested was not found."
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/IFTTT.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/IFTTT.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.ifttt.com/p/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "The requested page or file does not exist"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Imgur.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Imgur.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://imgur.com/user/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Instagram.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Instagram.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.instagram.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "The link you followed may be broken"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.instructables.com/member/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "404: We're sorry, things break sometimes"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Keybase.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Keybase.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://keybase.io/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
6
sopel_modules/SpiceBot_Configs/sherlock/Kongregate.json
Normal file
6
sopel_modules/SpiceBot_Configs/sherlock/Kongregate.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"url": "https://www.kongregate.com/accounts/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Sorry, no account with that name was found.",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
6
sopel_modules/SpiceBot_Configs/sherlock/LiveJournal.json
Normal file
6
sopel_modules/SpiceBot_Configs/sherlock/LiveJournal.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"url": "https://{}.livejournal.com",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Unknown Journal",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Medium.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Medium.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://medium.com/@{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/MixCloud.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/MixCloud.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.mixcloud.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page Not Found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Newgrounds.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Newgrounds.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://{}.newgrounds.com",
|
||||
"errorType": "status_code",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Pastebin.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Pastebin.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://pastebin.com/u/{}",
|
||||
"errorType": "response_url",
|
||||
"errorUrl": "https://pastebin.com/index"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Patreon.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Patreon.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://www.patreon.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Pexels.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Pexels.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.pexels.com/@{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Ouch, something went wrong!"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Pinterest.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Pinterest.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.pinterest.com/{}",
|
||||
"errorType": "response_url",
|
||||
"errorUrl": "https://www.pinterest.com/?show_error=true"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Reddit.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Reddit.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.reddit.com/user/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "page not found"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.reverbnation.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Sorry, we couldn't find that page"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Roblox.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Roblox.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.roblox.com/user.aspx?username={}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page cannot be found or no longer exists"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Scribd.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Scribd.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.scribd.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page not found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Slack.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Slack.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://{}.slack.com",
|
||||
"errorType": "status_code",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/SlideShare.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/SlideShare.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://slideshare.net/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/SoundCloud.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/SoundCloud.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://soundcloud.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Spotify.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Spotify.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://open.spotify.com/user/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Steam.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Steam.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://steamcommunity.com/id/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "The specified profile could not be found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Tinder.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Tinder.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.gotinder.com/@{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Looking for Someone?"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Trakt.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Trakt.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.trakt.tv/users/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "404"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Trip.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Trip.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.trip.skyscanner.com/user/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Page not found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/TripAdvisor.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/TripAdvisor.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://tripadvisor.com/members/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "This page is on vacation…"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Twitter.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Twitter.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.twitter.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "page doesn’t exist"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/Unsplash.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/Unsplash.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://unsplash.com/@{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/VK.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/VK.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://vk.com/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
4
sopel_modules/SpiceBot_Configs/sherlock/VSCO.json
Normal file
4
sopel_modules/SpiceBot_Configs/sherlock/VSCO.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"url": "https://vsco.co/{}",
|
||||
"errorType": "status_code"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Vimeo.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Vimeo.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://vimeo.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "404 Not Found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/Wattpad.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/Wattpad.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.wattpad.com/user/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "This page seems to be missing..."
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/WeHeartIt.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/WeHeartIt.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://weheartit.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Oops! You've landed on a moving target!"
|
||||
}
|
||||
6
sopel_modules/SpiceBot_Configs/sherlock/WordPress.json
Normal file
6
sopel_modules/SpiceBot_Configs/sherlock/WordPress.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"url": "https://{}.wordpress.com",
|
||||
"errorType": "response_url",
|
||||
"errorUrl": "wordpress.com/typo/?subdomain=",
|
||||
"noPeriod": "True"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/YouTube.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/YouTube.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://www.youtube.com/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Not Found"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/devRant.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/devRant.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://devrant.com/users/{}",
|
||||
"errorType": "response_url",
|
||||
"errorUrl": "https://devrant.com/"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/iMGSRC.RU.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/iMGSRC.RU.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://imgsrc.ru/main/user.php?user={}",
|
||||
"errorType": "response_url",
|
||||
"errorUrl": "https://imgsrc.ru/"
|
||||
}
|
||||
5
sopel_modules/SpiceBot_Configs/sherlock/last.fm.json
Normal file
5
sopel_modules/SpiceBot_Configs/sherlock/last.fm.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"url": "https://last.fm/user/{}",
|
||||
"errorType": "message",
|
||||
"errorMsg": "Whoops! Sorry, but this page doesn't exist."
|
||||
}
|
||||
49
sopel_modules/SpiceBot_Core_Commands/Sherlock.py
Normal file
49
sopel_modules/SpiceBot_Core_Commands/Sherlock.py
Normal file
@ -0,0 +1,49 @@
|
||||
# coding=utf8
|
||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||
|
||||
# sopel imports
|
||||
import sopel.module
|
||||
|
||||
import spicemanip
|
||||
|
||||
import sopel_modules.SpiceBot as SpiceBot
|
||||
|
||||
|
||||
@SpiceBot.prerun.prerun('module')
|
||||
@sopel.module.commands('sherlock', 'username')
|
||||
def bot_command_sherlock(bot, trigger):
|
||||
|
||||
netlist = list(SpiceBot.sherlock.dict.keys())
|
||||
|
||||
username = spicemanip.main(trigger.sb["args"], 1) or trigger.nick
|
||||
trigger.sb["args"] = spicemanip.main(trigger.sb["args"], "2+", 'list')
|
||||
|
||||
checklist = netlist
|
||||
checklistname = 'all'
|
||||
if SpiceBot.inlist(username, netlist):
|
||||
checklistname = SpiceBot.inlist_match(username, netlist)
|
||||
checklist = [checklistname]
|
||||
username = spicemanip.main(trigger.sb["args"], 1) or trigger.nick
|
||||
|
||||
bot.osd("Checking username " + username + " in " + checklistname + " network.")
|
||||
|
||||
inlist, notinlist = [], []
|
||||
|
||||
for social_network in checklist:
|
||||
|
||||
in_social = SpiceBot.sherlock.check_network(username, social_network)
|
||||
if in_social:
|
||||
inlist.append(social_network)
|
||||
else:
|
||||
notinlist.append(social_network)
|
||||
|
||||
if len(inlist):
|
||||
if checklistname != 'all':
|
||||
bot.osd(["The username " + username + " is in " + checklist[0], SpiceBot.sherlock.dict.get(social_network).get("url").format(username)])
|
||||
else:
|
||||
bot.osd(["The username " + username + " is in the following:", spicemanip.main(inlist, "andlist")], trigger.nick, 'NOTICE')
|
||||
if len(notinlist):
|
||||
if checklistname != 'all':
|
||||
bot.osd(["The username " + username + " is NOT in the following:", spicemanip.main(notinlist, "andlist")])
|
||||
else:
|
||||
bot.osd(["The username " + username + " is NOT in the following:", spicemanip.main(notinlist, "andlist")], trigger.nick, 'NOTICE')
|
||||
@ -19,6 +19,7 @@ from .BotPrivs import *
|
||||
from .Search import *
|
||||
from .AI import *
|
||||
from .Gif import *
|
||||
from .Sherlock import *
|
||||
|
||||
__author__ = 'Sam Zick'
|
||||
__email__ = 'sam@deathbybandaid.net'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user