In the Google Web History interface I can see all the search queries I have used over the years, and the pages I visited for a particular query. Is there a way I can retrieve this history using a computer program? I couldn't find a Google API that does it. Do you know of a tool that can do this, or suggest a way to achieve this?
There's an RSS feed.
Update: the link is now broken.
The RSS feed in the accepted answer above does not exist anymore. Google does not provide an API that allows you retrieve Google searches, but it does allow you to download an archive of all past searches, via google search history. This download cannot be performed programmatically, as it saves the archive to the user's google drive.
A possible hacky workaround is using browser automation tools to scrape the history page, like this repository does. Modifying this script would allow you to get the most recent searches. I was able to use this for my project.
来源:https://stackoverflow.com/questions/3130484/how-can-i-retrieve-my-google-search-history