Fixed xhamster ripper

This commit is contained in:
cyian-1756 2018-10-06 09:03:52 -04:00
parent 7e890bce2f
commit 630f84eab3

View File

@ -124,20 +124,16 @@ public class XhamsterRipper extends AbstractHTMLRipper {
@Override @Override
public List<String> getURLsFromPage(Document doc) { public List<String> getURLsFromPage(Document doc) {
LOGGER.debug("Checking for urls");
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
for (Element thumb : doc.select("div.picture_view > div.pictures_block > div.items > div.item-container > a > div.thumb_container > div.img > img")) { for (Element page : doc.select("div.items > div.item-container > a.item")) {
String image = thumb.attr("src"); String pageWithImageUrl = page.attr("href");
// replace thumbnail urls with the urls to the full sized images try {
image = image.replaceAll( String image = Http.url(new URL(pageWithImageUrl)).get().select("div.picture_container > a > img").attr("src");
"https://upt.xhcdn\\.", result.add(image);
"http://up.xhamster."); } catch (IOException e) {
image = image.replaceAll("ept\\.xhcdn", "ep.xhamster"); LOGGER.error("Was unable to load page " + pageWithImageUrl);
image = image.replaceAll( }
"_160\\.",
"_1000.");
// Xhamster has bad cert management and uses invalid certs for some cdns, so we change all our requests to http
image = image.replaceAll("https", "http");
result.add(image);
} }
return result; return result;
} }