-
Notifications
You must be signed in to change notification settings - Fork 0
/
google_search.py
39 lines (19 loc) · 874 Bytes
/
google_search.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
import googlesearch #pip install googlesearch
import webbrowser # pip install webbrowser
from googlesearch import search
query=input("enter your query:")
query1=""
list_needed=""
if 'who is' in query: #you can use any wh word as prefix to the question
chrome_path = r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe %s'
print('loading')
query2=""
list_needed=""
str2=""
if 'who is' in query :
list_name=list(query)
list_needed=list_name[7:] # make sure you slice 1+ index than your prefix to the question
for word in list_needed:
str2 += word
for url in search(str2, tld="co.in", num=1, stop = 1, pause = 2):
webbrowser.open("https://google.com/search?q=%s" % str2)