APISonar


com.rarchives.ripme.utils.Http.Http

> com > rarchives > ripme > utils > Http > Http
com APIs rarchives APIs ripme APIs utils APIs Http APIs Http APIs

Example 1
public List<String> getURLsFromPage(Document doc) {
        List<String> imageURLs = new ArrayList<>();
        for (Element thumb : doc.select("div#gallery > div > a")) {
            String imageURL = thumb.attr("href");
            try {
                Document imagedoc = new Http("http://imagearn.com/" + imageURL).get();
                String image = imagedoc.select("a.thickbox").first().attr("href");
                imageURLs.add(image);
            } catch (IOException e) {
                LOGGER.warn("Was unable to download page: " + imageURL);
            }
        }
        return imageURLs;
    }
Example 2
private String getUserID(String username) throws IOException {
        logger.info("Fetching user ID for " + username);
        JSONObject json = new Http("https://api.500px.com/v1/" +
                    "users/show" +
                    "?username=" + username +
                    "&consumer_key=" + CONSUMER_KEY)
                .getJSON();
        return Long.toString(json.getJSONObject("user").getLong("id"));
    }
Example 3
private String getFullSizeImage(String imageUrl) throws IOException {
        sendUpdate(STATUS.LOADING_RESOURCE, imageUrl);
        Document doc = new Http(imageUrl).get(); // Retrieve the webpage  of the image URL
        Element fullSizeImage = doc.select(".photo").first(); // Select the "photo" element from the page (there should only be 1)
        String path = "https://cdn.ampproject.org/i/s/www.8muses.com/data/ufu/small/" + fullSizeImage.children().select("#imageName").attr("value"); // Append the path to the fullsize image file to the standard prefix
        return path;
    }