Created
November 10, 2012 07:47
-
-
Save emir/4050334 to your computer and use it in GitHub Desktop.
Terminal search with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webbrowser | |
message = "you searched" | |
message1 = "from" | |
p = raw_input('where: ') | |
s = raw_input('what: ') | |
def google(d): | |
return 'https://www.google.com.tr/#hl=tr&output=search&q=%s' %(s) | |
def youtube(d): | |
return 'http://youtube.com/results?search_query='+s | |
def twitter(d): | |
return 'https://twitter.com/search?q='+s | |
def wiki(d): | |
return 'http://tr.wikipedia.org/wiki/%C3%96zel:Ara?search=%s&go=Ara' %(s) | |
def fizy(d): | |
return 'http://fizy.com/#q/%s' %(s) | |
def eksi(d): | |
return 'http://beta.eksisozluk.com/ara?searchform.keywords=%s' %(s) | |
def facebook(d): | |
f = raw_input('filter: ') | |
if f == "page": | |
return 'https://www.facebook.com/search/results.php?q=%s&type=pages' %(s) | |
if f == "events": | |
return 'https://www.facebook.com/search/results.php?q=%s&type=events' %(s) | |
if f == "users": | |
return 'https://www.facebook.com/search/results.php?q=%s&type=users' %(s) | |
return 'https://www.facebook.com/search/results.php?q='+s | |
def github(d): | |
f = raw_input('filter: ') | |
if f == "repo": | |
return 'https://github.com/search?q=%s&type=Repositories' %(s) | |
if f == "users": | |
return 'https://github.com/search?q=%s&type=Users' %(s) | |
if f == "code": | |
return 'https://github.com/search?q=%s&type=Code' %(s) | |
return 'https://github.com/search?q=%s&type=Everything' %(s) | |
def quora(d): | |
return 'www.quora.com/search?q='+s | |
mycase = { | |
'google': google, | |
'youtube': youtube, | |
'twitter': twitter, | |
'wiki': wiki, | |
'fizy': fizy, | |
'eksi': eksi, | |
'facebook': facebook, | |
'github': github, | |
'quora': quora, | |
} | |
s = '+'.join((s.split(' '))) | |
url_tube = mycase[p](s) | |
print message,s,message1,p | |
webbrowser.open(url_tube) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment