import re,urllib,urllib2 class GoogleHarvester: re_links = re.compile(r'Next
" in page: # Is there a "Next" link for next page of results ? currentPage += 100 # Yes, go to next page of results. else: break # No, break out of the while True loop. print "Google: Found %d links." % len(links) return sorted(links.keys()) # Example: Search for "monthy pythons" links = GoogleHarvester().harvest('monthy pythons') open("links.txt","w+b").write("\n".join(links)) #//python/1865