-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
53 lines (38 loc) · 1.38 KB
/
web.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
import webbrowser as w
import wikipedia
from engine1 import speak
import os
path = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
def search(query):
if "who is" in query:
qr = query[7:]
result = wikipedia.summary(qr, sentences=2)
speak(result)
elif "what is" in query:
qry = query[8:]
w.get(path).open(f"https://www.google.com/search?q={qry}")
elif "tell me about" in query:
qry = query[14:]
w.get(path).open(f"https://www.google.com/search?q={qry}")
elif "show me about" in query:
qry = query[14:]
w.get(path).open(f"https://www.google.com/search?q={qry}")
# Youtube search
elif "search" and "on youtube" in query:
qre = query[7:-11]
qrel = qre.split()
qre2 = '+'.join(qrel)
w.get(path).open(
f"https://www.youtube.com/results?search_query={qre2}")
def start(query):
if "google" in query:
speak("Opening...")
path = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Google Chrome.lnk"
os.startfile(path)
# open youtube
elif "youtube" in query:
speak("Opening...")
path1 = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
w.get(path1).open("https://www.youtube.com/?gl=IN")
def none(query):
w.get(path).open(f"https://www.google.com/search?q={query}")