Fixed xhamster ripper
This commit is contained in:
parent
7e890bce2f
commit
630f84eab3
@ -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\\.",
|
|
||||||
"http://up.xhamster.");
|
|
||||||
image = image.replaceAll("ept\\.xhcdn", "ep.xhamster");
|
|
||||||
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);
|
result.add(image);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("Was unable to load page " + pageWithImageUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user