Skip to content

Instantly share code, notes, and snippets.

@reee
Created August 27, 2015 02:32
Show Gist options
  • Save reee/2e81c4ff6754b785ea4a to your computer and use it in GitHub Desktop.
Save reee/2e81c4ff6754b785ea4a to your computer and use it in GitHub Desktop.
google-search.py
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