Package org.jsoup.nodes

Examples of org.jsoup.nodes.Document.title()


    @Test
    public void followsRelativeRedirect() throws IOException {
        Connection con = Jsoup.connect("http://direct.infohound.net/tools/302-rel.pl"); // to ./ - /tools/
        Document doc = con.post();
        assertTrue(doc.title().contains("HTML Tidy Online"));
    }

    @Test
    public void followsRedirectsWithWithespaces() throws IOException {
        Connection con = Jsoup.connect("http://tinyurl.com/kgofxl8"); // to http://www.google.com/?q=white spaces
View Full Code Here


    @Test
    public void followsRedirectsWithWithespaces() throws IOException {
        Connection con = Jsoup.connect("http://tinyurl.com/kgofxl8"); // to http://www.google.com/?q=white spaces
        Document doc = con.get();
        assertTrue(doc.title().contains("Google"));
    }

    @Test
    public void gracefullyHandleBrokenLocationRedirect() throws IOException {
        Connection con = Jsoup.connect("http://aag-ye.com"); // has Location: http:/temp/AAG_New/en/index.php
View Full Code Here

      baseURI = baseURI.substring(0, baseURI.indexOf("?"));
   
    Document doc = Jsoup.parse(responseBody, baseURI);
    //Document doc = Jsoup.parse(responseBody);
   
    String title = doc.title();
    logger.info("title:" + title);
    logger.info("elementSelector:" + elementSelector);
    Element sourceElement = doc.select(elementSelector).first();
    if(sourceElement == null)
      sourceElement = doc.select("#pageContent").first();
View Full Code Here

       
        Document doc=Jsoup.parse(page.getHtml());
        doc.setBaseUri(url);     
        page.setDoc(doc);
       
        String title=doc.title();
        String text=doc.text();
    
        ArrayList<Link> links = topNFilter(LinkUtils.getAll(page));
        ParseData parsedata = new ParseData(url,title, links);
        ParseText parsetext=new ParseText(url,text);
View Full Code Here

            int length = conn.getContentLength() / 1024;
            response = String.format("HTTP %s: %s", conn.getResponseCode(), conn.getResponseMessage());
            String info;
            if (type.contains("text") || type.contains("application")) {
                Document doc = Jsoup.connect(link).userAgent(USER_AGENT).followRedirects(true).get();
                String title = doc.title() == null || doc.title().isEmpty() ? "No title found!" : doc.title();
                info = String.format("%s - (Content Type: %s Size: %skb)", title, type, length);
                return info;
            }
            info = String.format("Content Type: %s Size: %skb", type, length);
            return info;
View Full Code Here

            int length = conn.getContentLength() / 1024;
            response = String.format("HTTP %s: %s", conn.getResponseCode(), conn.getResponseMessage());
            String info;
            if (type.contains("text") || type.contains("application")) {
                Document doc = Jsoup.connect(link).userAgent(USER_AGENT).followRedirects(true).get();
                String title = doc.title() == null || doc.title().isEmpty() ? "No title found!" : doc.title();
                info = String.format("%s - (Content Type: %s Size: %skb)", title, type, length);
                return info;
            }
            info = String.format("Content Type: %s Size: %skb", type, length);
            return info;
View Full Code Here

            int length = conn.getContentLength() / 1024;
            response = String.format("HTTP %s: %s", conn.getResponseCode(), conn.getResponseMessage());
            String info;
            if (type.contains("text") || type.contains("application")) {
                Document doc = Jsoup.connect(link).userAgent(USER_AGENT).followRedirects(true).get();
                String title = doc.title() == null || doc.title().isEmpty() ? "No title found!" : doc.title();
                info = String.format("%s - (Content Type: %s Size: %skb)", title, type, length);
                return info;
            }
            info = String.format("Content Type: %s Size: %skb", type, length);
            return info;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.