Skip to content

Instantly share code, notes, and snippets.

@egcodes
Last active December 20, 2015 01:39
Show Gist options
  • Save egcodes/6050399 to your computer and use it in GitHub Desktop.
Save egcodes/6050399 to your computer and use it in GitHub Desktop.
Command line tool for google search
# -*- coding: utf-8 -*-
import urllib2
import sys, re, os
from google import search
#Get keywords from args
if len(sys.argv) < 3:
print "Usage:\n python googlecmd.py <keywords> <keywords> ..."
exit()
searchKeyword = ""
for index in range(1, len(sys.argv)):
searchKeyword += sys.argv[index]
print "Google Cmd"
print "=========="
for url in search('%s'%searchKeyword, lang='tr', stop=10):
try:
pass
#f = urllib2.urlopen(url, timeout=3).read()
except Exception, error:
print "Sayfa acilamadi...(%s)"%str(error)
continue
print url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment