Skip to content

Instantly share code, notes, and snippets.

@emir
Created November 10, 2012 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emir/4050334 to your computer and use it in GitHub Desktop.
Save emir/4050334 to your computer and use it in GitHub Desktop.
Terminal search with Python
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