Created
January 17, 2011 18:26
-
-
Save vo/783202 to your computer and use it in GitHub Desktop.
Tiny Script to get Number of Search Results for wu*t
This file contains hidden or 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
#!/usr/bin/env python | |
# getting number of search results from google | |
# by christopher vo | |
import urllib2, re, time | |
reg = re.compile('About(.*?)results') | |
for i in range(1, 20): | |
wut = 'w' + 'u'*i + 't' | |
url = 'http://www.google.com/search?q=' + wut | |
request = urllib2.Request(url) | |
request.add_header('User-agent', 'Chrome') | |
search = reg.search(urllib2.urlopen(request).read()) | |
if search: | |
num = int(search.group(1).replace(',','')) | |
print i, num, wut | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment