ejes consulting

Leading organizations with techincal expertise.

deployment.py

without comments

#!/usr/local/bin/python

# <100,000 obsure
# 100,000-999,999 moderate
# 1,000,000 < 100,000,000 significat
# >100,000,000 very broad

import re,sys,os,urllib

if len(sys.argv)==1:
        print ‘Usage:\n%s “Search Term”\n’ % sys.argv[0]
        sys.exit(-1)

url=’http://www.google.ca/search?q=%22′+urllib.quote(sys.argv[1])+’%22&start=0&ie=utf-8&oe=utf-8&hl=xx-hacker&client=firefox-a&rls=org.mozilla:en-US:official’

(cstdin,cstdout,cstderr)=os.popen3(‘lynx -accept_all_cookies -dump ‘+url)

i=0
for code in cstdout.readlines():
        if re.compile(‘of about ‘).search(code):
                s=re.sub(‘(^.*of about | for.*\r?\n|,)’,”,code)
                i=int(s)

cstdin.close()
cstdout.close()
cstderr.close()

if i>100000000:
        print ‘Very Broadly Deployed (‘+str(i)+’ google hits)’
elif i>1000000:
        print ‘Significantly Deployed (‘+str(i)+’ google hits)’
elif i>100000:
        print ‘Moderately Deployed (‘+str(i)+’ google hits)’
else:
        print ‘Totaly Obsure (‘+str(i)+’ google hits)’

Written by ejes

August 24, 2009 at 12:26 pm

Leave a Reply