I am interested in some idea how to search term from a URL file such as google. Example if I look for a term call "LOVE". How can I find all the URL associated with that term? I do know how to connect to the URL, but I am not sure how to retrieve specific terms.

Thank you,

I would appreciate any help.

Recommended Answers

no doubt there are ways that you can implement a google search in your application. tried that?

Jump to Post

All 2 Replies

no doubt there are ways that you can implement a google search in your application. tried that?

Here is what I have so far now I need to extract the URL of the top 5 search results. ex <li class="g"><h3 class="r"><a href="/url?q=http://www.uga.edu/gradschool/programs/comp_sci1.html&amp;sa=U&amp;ei=7m7kUKiYFYjA9gSKs4HoBg&amp;ved=0CEIQFjAH&amp;usg=AFQjCNFxCFIRCOYTz5bwfvWC64vxi74KDw"><b>UGA</b> Graduate School - Degree <b>Programs</b>: <b>Computer Science</b> (MS)</a></h3> the program needs to extract the string between q= and & in the href= parameter of the <a> tag

import java.io.*;
import java.net.*;

public class urlSample {
     * @param args
     * @throws Exception 
    public static void main(String[] args) throws Exception {
        // TODO Auto-generated method stub
        //URL s1 = new URL("http://www.oracle.com");
        URL s1 = new URL("http://www.google.com/search");//?q=uga+computer+science+program");//&btnG=Search&oe=utf-8&rls=org.mozilla%3Aen-US%3Aofficial&client=firefox-a&channel=fflb&gbv=1");
        URL page1URL = new URL(s1, "search.html");
    //  doc.search(‘a[@href]’).map { |x| CGI.parse(x[‘href’][/\?.+/][1..-1])[‘id’].first }

        BufferedReader in = new BufferedReader(
              //      new InputStreamReader(s1.openStream()));
                     new InputStreamReader(s1.openStream()));
                    String inputLine;
                    while ((inputLine = in.readLine()) != null)


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.