Java Reference
In-Depth Information
{
int count = results.get(year);
if (count > maxCount)
{
result = year;
maxCount = count;
}
}
return result;
}
/**
* This method is called to determine the birth year for a
* person. It obtains 100 web pages that Google returns
* for that person. Each of these pages is then searched
* for the birth year of that person.
* Which ever year is selected the largest number of times
* is selected as the birth year.
*
* @param name The name of the person you are seeing the
* birth year for.
* @throws IOException Thrown if a communication error occurs.
*/
public void process(String name) throws IOException
{
search = new GoogleSearch();
search.setKey(key);
System.out.println("Getting search results form Google.");
Collection<GoogleSearchResultElement> c = getResults(name);
int i = 0;
System.out.println("Scanning URL's from Google.");
for (GoogleSearchResultElement element : c)
{
try
{
i++;
URL u = new URL(element.getURL());
System.out.println("Scanning URL: " + i + "/"
+ c.size() + ":" + u);
checkURL(u);
} catch (IOException e)
{
Search WWH ::




Custom Search