Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element.attr()


        Element alert = html.select("#authentication").first();
        assertThat("No authentication element found ", alert, is(notNullValue()));

        Element signOutLink = html.select("#authentication a").first();
        assertThat(alert.text(), containsString("Sign out"));
        assertThat(signOutLink.attr("href"), containsString("/signout"));
    }

    @Test
    public void signoutRedirectsToTheHomePage() throws Exception {
        UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
View Full Code Here


                    Elements links = document.select("a");
                    if (links.size() > 1) {
                        for (int i = 1; i < links.size(); i++) {
                            Element link = links.get(i);
                            String absoluteHref = link.attr("abs:href");
                            this.proxyHttp(absoluteHref, filter);
                        }
                    }
                } catch (UnsupportedMimeTypeException e) {
                    // ignore
View Full Code Here

                Elements links = document.select("a");
                if (links.size() > 1) {
                    for (int i = 1; i < links.size(); i++) {
                        Element link = links.get(i);
                        String absoluteHref = link.attr("abs:href");
                        this.populateFromHttp(absoluteHref, filter, update);
                    }
                }
            }
        }
View Full Code Here

        Elements embeds = doc.select("embed");
        if (embeds.size() == 0) {
            throw new IOException("Could not find Embed code at " + url);
        }
        Element embed = embeds.get(0);
        String vars = embed.attr("flashvars");
        for (String var : vars.split("&")) {
            if (var.startsWith("flv_url=")) {
                String vidUrl = var.substring("flv_url=".length());
                vidUrl = URLDecoder.decode(vidUrl, "UTF-8");
                addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
View Full Code Here

        Elements videos = doc.select("video");
        if (videos.size() == 0) {
            throw new IOException("Could not find Embed code at " + url);
        }
        Element video = videos.get(0);
        String vidUrl = video.attr("src");
        addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
        waitForThreads();
    }
}
View Full Code Here

    @Override
    public String getAlbumTitle(URL url) throws MalformedURLException {
        try {
            // Attempt to use album title as GID
            Element titleElement = getFirstPage().select("meta[name=description]").first();
            String title = titleElement.attr("content");
            title = title.substring(title.lastIndexOf('/') + 1);
            return getHost() + "_" + title.trim();
        } catch (IOException e) {
            // Fall back to default album naming convention
            logger.info("Unable to find title at " + url);
View Full Code Here

                if (images.size() == 0) {
                    logger.warn("Image not found at " + this.url);
                    return;
                }
                Element image = images.first();
                String imgsrc = image.attr("src");
                imgsrc = "http://" + this.url.getHost() + "/" + imgsrc;
                // Provide prefix and let the AbstractRipper "guess" the filename
                String prefix = "";
                if (Utils.getConfigBoolean("download.save_order", true)) {
                    prefix = String.format("%03d_", index);
View Full Code Here

            // Last page
            throw new IOException("No more pages");
        }
        Elements els = doc.select("li.next > a");
        Element first = els.first();
        String nextURL = first.attr("href");
        nextURL = "http://www.hentai-foundry.com" + nextURL;
        return Http.url(nextURL)
                   .referrer(url)
                   .cookies(cookies)
                   .get();
View Full Code Here

        // Image URLs are basically thumbnail URLs with a different domain, a simple
        // path replacement, and a ?xxxxxx post ID at the end (obtainable from the href)
        for (Element thumbSpan : doc.select("div.content > div > span.thumb")) {
            String postId = thumbSpan.attr("id").replaceAll("p", "");
            Element thumb = thumbSpan.getElementsByTag("img").first();
            String image = thumb.attr("abs:src")
                                .replace("i.sankakucomplex.com/data/preview",
                                         "is.sankakucomplex.com/data") + "?" + postId;
            imageURLs.add(image);
        }
        return imageURLs;
View Full Code Here

    @Override
    public Document getNextPage(Document doc) throws IOException {
        Element pagination = doc.select("div.pagination").first();
        if (pagination.hasAttr("next-page-url")) {
            return Http.url(pagination.attr("abs:next-page-url")).cookies(cookies).get();
        } else{
            return null;
        }
    }
}
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.