This is my first python script. Many thanks to the folks at python-forums.org for the help! There is nothing really special, I just wanted to do more than a hello world.
This was made using Active Python 2.5 for OS X and using both emacs, and Smultron for editing.
#!/usr/local/bin/python
import re
import string
import urllib
url = 'http://www.dogpile.com/info.dogpl/search/web/'
print "Enter your search term \n"
query = raw_input()
#print headers
url = url+query
response = urllib.urlretrieve(url, 'response.html')
print 'Your HTML SERP was saved as response.html'
print "press enter to quit"
raw_input()
which gives you command line output like this:
:~ ChrisCopeland$ ./blog.py
Enter your search term
blogger.com
Your HTML SERP was saved as response.html
press enter to quit
and my html document is a raw dump of the SERP from dogpile.
I would also like to warn anyone, a call like this to some search engines (especially ones that start with a capital G), consider this to be a violation of the terms of service, so just be careful.
Enjoy
No comments:
Post a Comment