Added ASAP ripping
This commit is contained in:
parent
dd9a81a4f5
commit
ec64de1c9b
@ -26,6 +26,12 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
super(url);
|
super(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int index = 1;
|
||||||
|
|
||||||
|
@Override public boolean hasASAPRipping() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return "xhamster";
|
return "xhamster";
|
||||||
@ -151,13 +157,14 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
String pageWithImageUrl = page.attr("href");
|
String pageWithImageUrl = page.attr("href");
|
||||||
try {
|
try {
|
||||||
String image = Http.url(new URL(pageWithImageUrl)).get().select("div.picture_container > a > img").attr("src");
|
String image = Http.url(new URL(pageWithImageUrl)).get().select("div.picture_container > a > img").attr("src");
|
||||||
result.add(image);
|
downloadFile(image);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error("Was unable to load page " + pageWithImageUrl);
|
LOGGER.error("Was unable to load page " + pageWithImageUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.add(doc.select("div.player-container > a").attr("href"));
|
String imgUrl = doc.select("div.player-container > a").attr("href");
|
||||||
|
downloadFile(imgUrl);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -166,6 +173,15 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
public void downloadURL(URL url, int index) {
|
public void downloadURL(URL url, int index) {
|
||||||
addURLToDownload(url, getPrefix(index));
|
addURLToDownload(url, getPrefix(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void downloadFile(String url) {
|
||||||
|
try {
|
||||||
|
addURLToDownload(new URL(url), getPrefix(index));
|
||||||
|
index = index + 1;
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
LOGGER.error("The url \"" + url + "\" is malformed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAlbumTitle(URL url) throws MalformedURLException {
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
|
Loading…
Reference in New Issue
Block a user