DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Python (http://www.daniweb.com/forums/forum114.html)
-   -   Google Results and Python (http://www.daniweb.com/forums/thread166267.html)

betatype Jan 5th, 2009 12:50 pm
Google Results and Python
 
Question about gathering search results for a phrase with Python. I wrote a simple script for my personal SEO purposes that would go out and collect the top 30 search results on Google and then return a list of those URL's. The trouble is everytime I try to run my script Google starts returning an error about the search not being allowed. The URL I'm using works fine if entered manually but Google seems to know I'm trying to get access through a script. Is there a way around this or an API that I should be using? My searches into the subject haven't given me much.

mn_kthompson Jan 5th, 2009 4:17 pm
Re: Google Results and Python
 
Google does not allow searches from any devices that does not provide a commonly used agent string. When you gather data using python the agent string is something like "python 2.6". Google doesn't allow that because they don't want people using scripts to gather their search results.

The answer is to spoof your agent string. I recently wrote up a script that does something similar to what you're trying to do. I wrote a blog entry about it and included sample code that you might want to check out.
http://blackfistsecurity.blogspot.co...king-with.html


All times are GMT -4. The time now is 5:32 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC