Results 1 to 2 of 2
  1. #1
    IYIaster is offline Member
    Join Date
    Jul 2009
    Posts
    46
    Rep Power
    0

    Default Get text from website.

    I'm trying to get the text from a website. This does give me information from the website. But, it returns all of the HTML. I am looking for a way just to get the plain text off of the website. Anyone know of a way to do this?

    Java Code:
            BufferedReader in = null;
            String getid = null;
            try {
                URL yahoo;
                yahoo = new URL("http://www.yahoo.com");
                in = new BufferedReader(new InputStreamReader(yahoo.openStream()));
                String inputLine;
    
    
                while ((inputLine = in.readLine()) != null) {
    
                     System.out.println(inputLine);
                    }
                }
                in.close();
            } catch (IOException ex) {
                Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }

  2. #2
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by IYIaster View Post
    I'm trying to get the text from a website. This does give me information from the website. But, it returns all of the HTML.
    But what else are you expecting to find on a website?

    I am looking for a way just to get the plain text off of the website. Anyone know of a way to do this?
    Are you looking to parse the HTML? If so, then perhaps your best bet is to Google for a decent Java HTML parser.

    Buena suerte.

Similar Threads

  1. programming website?
    By ragarwal in forum Forum Lobby
    Replies: 11
    Last Post: 12-21-2009, 01:37 PM
  2. migrate JSP website
    By valhensing in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 12-14-2009, 04:34 PM
  3. Writing to a website
    By Shawn in forum New To Java
    Replies: 6
    Last Post: 03-20-2009, 01:32 PM
  4. WebSite Update!
    By Xyle in forum Reviews / Advertising
    Replies: 1
    Last Post: 02-16-2009, 09:47 AM
  5. How to download website (Get all link in website)
    By finalmem in forum Advanced Java
    Replies: 0
    Last Post: 11-12-2008, 09:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •