Downloading and Parsing Google Search Results

Google blocks accesses to its search results from unsupported user agents as a deterrent to keep people from stealing its intellectual property. This is rarely a concern when accessing Google from a web browser, but it becomes a bit of a problem when attempting to download from Google using the JRE’s URL class. For example, Google returns HTTP response code 403 (Forbidden) when executing the following code from a command-line tool.