Created
August 27, 2015 02:32
-
-
Save reee/2e81c4ff6754b785ea4a to your computer and use it in GitHub Desktop.
google-search.py
This file contains 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
for k in keywords_list: | |
google_add = random.choice(google_adds_list) | |
url = make_up_url(google_add, k, False) | |
if scrape_keyword_count(k, useragent_list, url, result_dir): | |
keyword_count = scrape_keyword_count(k, useragent_list, url, result_dir) | |
all_keyword_count.append(keyword_count) | |
print '%s Finish. Removeing it from the list' % k | |
keywords_list.remove(k) | |
else: | |
print "%s may run into problem, removing it from list" % google_add | |
google_adds_list.remove(google_add) | |
with open(google_adds, 'w') as f: | |
f.write('\n'.join(google_adds_list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment