-
Notifications
You must be signed in to change notification settings - Fork 0
/
aioSearch.py
107 lines (86 loc) · 3.96 KB
/
aioSearch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from subprocess import call
import re
import sys
import webbrowser
from dhooks import Webhook, Embed
print("""\
___ _____ _____ _____ _
/ _ \|_ _| _ | / ___| | |
/ /_\ \ | | | | | | \ `--. ___ __ _ _ __ ___| |__
| _ | | | | | | | `--. \/ _ \/ _` | '__/ __| '_ \
| | | |_| |_\ \_/ / /\__/ / __/ (_| | | | (__| | | |
\_| |_/\___/ \___/ \____/ \___|\__,_|_| \___|_| |_|
""")
links = []
filename = 'searches.txt'
hook = Webhook('WEBHOOK HERE')
# if hook == '':
# hook = input("What's the webhook? ")
# else:
# print("Webhook detected")
def successhook():
embed = Embed(
title='AIO Search Executed Successfully',
description="AIO Search Program was able to open you're defined searches",
color=0x00ff1e,
timestamp='now' # sets the timestamp to current time
)
image1 = 'https://avatars2.githubusercontent.com/u/25069719?s=460&u=0758922d6a85a09f971fbf778bb720788a2f2e5b&v=4'
with open('https://avatars2.githubusercontent.com/u/25069719?s=460&u=0758922d6a85a09f971fbf778bb720788a2f2e5b&v=4', rb) as f:
image1 = f.read() # bytes
hook.modify(name='AIO Search', avatar=image1)
embed.set_footer(text='AIO Search | Made by iHildy#3839', icon_url=image1)
hook.send(embed=embed)
def badhook():
embed = Embed(
title='AIO Search Failed',
description="AIO Search Program was un-able to open you're defined searches",
color=0xff0000,
timestamp='now' # sets the timestamp to current time
)
image1 = 'https://avatars2.githubusercontent.com/u/25069719?s=460&u=0758922d6a85a09f971fbf778bb720788a2f2e5b&v=4'
# hook.modify(name='AIO Search', avatar=image1)
embed.set_footer(text='AIO Search | Made by iHildy#3839', icon_url=image1)
hook.send(embed=embed)
def aiosearch():
searchtype = input(
'[1] Regular Search\n[2] Definition\n[3] Google Maps\n[4] Youtube\n[5] Github\n[6] StackOverflow\nWhat type of search is this for? (example: 3): ')
try:
with open(filename) as linkListFile:
for line in linkListFile:
link = line.strip()
if link != '':
if re.match('http://.+|https://.+|ftp://.+|file://.+', link.lower()):
links.append(link)
elif searchtype == "1":
links.append('https://www.google.com/search?q=' + link)
success = True
elif searchtype == "2":
subject = input("What subject/class is this for? ")
links.append('https://www.google.com/search?q=' + link + ' ' + subject + ' definition')
success = True
elif searchtype == "3":
links.append('http://maps.google.com/?q=' + link)
success = True
elif searchtype == "4":
links.append('https://www.youtube.com/results?search_query=' + link)
success = True
elif searchtype == "5":
links.append('https://github.com/search?q=' + link)
success = True
elif searchtype == "6":
links.append('https://stackoverflow.com/search?q=' + link)
success = True
else:
success = False
print(
"Something went wrong, you might not have typed the number in right.")
badhook()
if success: successhook()
except IOError:
print('Something went wrong, make sure you filled the searches.txt file correctly, and gave the program the correct path inside')
sys.exit()
print(links)
for lnk in links:
webbrowser.open_new_tab(lnk)
aiosearch()