Rectangle 27 0

Upon further research, you can't get more than 4 results with a single call. You have to set the start parameter in the URL and query more than once.

Look, it's easy, just do this (working from your linked code):

public static void main(String[] args) throws IOException {
    List<Result> listResults = new ArrayList<Result>();
    for(int i = 0; i < 10; i++) {
      String address = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=" + i * 4 + "&q=";
      String query = "java tutorial";
      String charset = "UTF-8";

      URL url = new URL(address + URLEncoder.encode(query, charset));
      Reader reader = new InputStreamReader(url.openStream(), charset);
      GoogleResults results = new Gson().fromJson(reader, GoogleResults.class);
      listResults.addAll(results.getResponseData.getResults());
    }

It's working only for the first 4 iteration.

But how can I set the start parameter in the url ?

Can you give me an example - in java code ? Please :) .

&start=4

So the link should be like : URL url = new URL(address + URLEncoder.encode(query, charset) + "&start=4" ); ? -> in this way it doesn't working. And like this : URL url = new URL(address + "&start=4"+ URLEncoder.encode(query, charset) ); -> things doesn't changing. No matter what i do, this returns me only 4 results.

more than 4 results on google api search java code - Stack Overflow

java api search result
Rectangle 27 0

I have changed the while loop in the code provided by @Zakaria above. It might not be a proper way of working it out but it gives you the result links of google search. You just need to parse the output. See here,

public static void main(String[] args) throws Exception {

    String key="YOUR KEY";
    String qry="Android";
    URL url = new URL(
            "https://www.googleapis.com/customsearch/v1?key="+key+ "&cx=013036536707430787589:_pqjad5hr1a&q="+ qry + "&alt=json");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("GET");
    conn.setRequestProperty("Accept", "application/json");
    BufferedReader br = new BufferedReader(new InputStreamReader(
            (conn.getInputStream())));

    String output;
    System.out.println("Output from Server .... \n");
    while ((output = br.readLine()) != null) {

        if(output.contains("\"link\": \"")){                
            String link=output.substring(output.indexOf("\"link\": \"")+("\"link\": \"").length(), output.indexOf("\","));
            System.out.println(link);       //Will print the google search links
        }     
    }
    conn.disconnect();                              
}

i get links details, but have you know any way to get webpage details which are open from these links.

This is giving me an HTTP error code of 400. Is there a limit to how many queries you can make per day? If so, what is that limit?

Java code for using google custom search API - Stack Overflow

java api google-custom-search
Rectangle 27 0

More generally, do you mean the best way to parse JSON into Java objects? Android's org.json parser, at least for general-purpose DOM-style parsing. It's reasonably fast on small data sets and comes built in to the OS.

java - How to parse google search results in android code - Stack Over...

java android parsing
Rectangle 27 0

I would have told you to use one of their API. Unfortunatly, there does not seems to exist one for search. As a consequence, you'll have to use HtmlUnit to emulate a browser and go see their results (obviously, you can go the harder way and do some HTTP queries by yourself. But who would do that ?).

How to search in google by using java code? - Stack Overflow

java google-app-engine
Rectangle 27 0

If this 'help' is going to be online than you can embed google search in it (limiting the search results to specified site:). Alternatively if you're hosting the pages yourself you can use htdig for indexing the pages.

However if it's going to offilne you'll be better of by generating a static index page with links to topics. In order to create a more help-system-alike user experience you can hide the contents of the index in the invisible html DIV tags and add a JavaScript that takes searched phrase as an input and that unhides the matched words with their links.

That also came to my mind. But from my experience the search results tend to be incomplete, as the pages have to be indexed and it's not very likely that all pages of a website get indexed (note that indexed != crawled)

this help is offline for that particular user manual.I m already providing static inedx but now i want to provide some flexibility to user to find particular help page thts why i m doing search engine...I want to design search engine exactly similar to Help n supprt of Windows.....

How to search a word in a html file without any java coding? - Stack O...

html
Rectangle 27 0

Solving this issue, from what I understand, has nothing to do with bar codes. You have an image, that is available through an URL, and you must download it. That problem has been viewed many times on stack overflow and you would have found it if you did the search: "java downloading an image". It was the first result that came up for me in google.

java - making and storing a barcode image from a barcode URL (Barcode4...

java image url barcode barcode4j
Rectangle 27 0

Unfortunately the SOAP API has been deprecated. But you can use the AJAX API for non-JavaScript purposes as well, see for example:

See also the StackOverflow questions. Actually it seems your question is a duplicate of these, so it might be closed soon:

How to search in google by using java code? - Stack Overflow

java google-app-engine
Rectangle 27 0

If your base programming concepts are clear no language should be difficult for you. I have switched over from vb 6 to java to c# to objective c now. What really makes a coders life easy is the IDE, debugging tools, documentation and lot of blog posts which google can search :-) regarding one man team my personal view is I am at my best when left to code and research alone with the help of google and stack overflow ofcourse :-) so I do think in programming large sized teams often lead to more screw ups than results

Is Java too complex a programming language for a beginner one man prog...

java
Rectangle 27 0

I have changed the while loop in the code provided by @Zakaria above. It might not be a proper way of working it out but it gives you the result links of google search. You just need to parse the output. See here,

public static void main(String[] args) throws Exception {

    String key="YOUR KEY";
    String qry="Android";
    URL url = new URL(
            "https://www.googleapis.com/customsearch/v1?key="+key+ "&cx=013036536707430787589:_pqjad5hr1a&q="+ qry + "&alt=json");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("GET");
    conn.setRequestProperty("Accept", "application/json");
    BufferedReader br = new BufferedReader(new InputStreamReader(
            (conn.getInputStream())));

    String output;
    System.out.println("Output from Server .... \n");
    while ((output = br.readLine()) != null) {

        if(output.contains("\"link\": \"")){                
            String link=output.substring(output.indexOf("\"link\": \"")+("\"link\": \"").length(), output.indexOf("\","));
            System.out.println(link);       //Will print the google search links
        }     
    }
    conn.disconnect();                              
}

i get links details, but have you know any way to get webpage details which are open from these links.

This is giving me an HTTP error code of 400. Is there a limit to how many queries you can make per day? If so, what is that limit?

java.io.IOException: Server returned HTTP response code: 403

Java code for using google custom search API - Stack Overflow

java api google-custom-search