- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPySearch.py
More file actions
Latest commit
49 lines (43 loc) · 1.62 KB
/
Copy pathPySearch.py
File metadata and controls
49 lines (43 loc) · 1.62 KB
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
importwebbrowser
importos
#the beginning urls for three search engines
gUrl="www.google.com/search?q="
yUrl="search.yahoo.com/search?p="
bUrl="www.bing.com/search?q="
urls= [gUrl,yUrl,bUrl]
new=2# open in new tab if an obtion
defgetAvailableBrowser():
#using the browsers in webbwoser determine which ones are availabe on the system
posBrowser= ['mozilla','firefox','netscape','galeon','epiphany','skipstone','kfmclient',
'konqueror','kfm','mosaic','opera','grail','links','elinks','lynx','w3m',
'windows-default','macosx''safari','google-chrome','chrome','chromium','chromium-browser']
availableBrowsers= []
forxinposBrowser:
try:
webbrowser.get(x)
availableBrowsers.append(x)
except:
pass
returnavailableBrowsers
defgoSearch(browser,searchString):
#take the browser and the search string and serch all engines in urls
forsearcherinurls:
webbrowser.get(browser).open(searcher+searchString,new=new)
defgoIndSearch(browser,searchString,engine):
#makes the ability to search one engine
dict= {'Google': gUrl, 'Yahoo': yUrl, 'Bing': bUrl}
x=str(dict[engine])
webbrowser.get(browser).open(x+searchString,new=new)
if__name__=="__main__":
AvBrowser=getAvailableBrowser()
try:
os.system('clear')
except:
pass
y=0
forxinAvBrowser:
printstr(y) +". "+x
y=y+1
browser=raw_input("please enter the number to your browser: ")
searchString=raw_input("please input search: ")
goSearch(AvBrowser[int(browser)],searchString)