Java Reference
In-Depth Information
{
GoogleSearchResultElement element =
(GoogleSearchResultElement) list[i];
result.add(element);
}
}
top = top + 10;
System.out.println(top);
} while (resultCount >= 10);
return result;
}
/**
* For the given URL check how many links the URL has.
*
* @param url The URL to check.
* @return The number of links that URL has.
*/
public static int getLinkCount(String url)
{
int result = 0;
search.setQueryString("link:" + url);
GoogleSearchResult r = null;
try
{
r = search.doSearch();
} catch (GoogleSearchFault e)
{
e.printStackTrace();
}
result = r.getEstimatedTotalResultsCount();
return result;
}
/**
* The main method processes the command line arguments and
* then calls getResults to build up the list.
*
* @param args Holds the Google key and the site to search.
*/
public static void main(String args[])
{
if (args.length < 2)
Search WWH ::




Custom Search