commit
39049d1d85
@ -57,19 +57,21 @@ public class XvideosRipper extends VideoRipper {
|
|||||||
public void rip() throws IOException {
|
public void rip() throws IOException {
|
||||||
logger.info(" Retrieving " + this.url);
|
logger.info(" Retrieving " + this.url);
|
||||||
Document doc = Http.url(this.url).get();
|
Document doc = Http.url(this.url).get();
|
||||||
Elements embeds = doc.select("embed");
|
Elements scripts = doc.select("script");
|
||||||
if (embeds.size() == 0) {
|
for (Element e : scripts) {
|
||||||
throw new IOException("Could not find Embed code at " + url);
|
if (e.html().contains("html5player.setVideoUrlHigh")) {
|
||||||
}
|
logger.info("Found the right script");
|
||||||
Element embed = embeds.get(0);
|
String[] lines = e.html().split("\n");
|
||||||
String vars = embed.attr("flashvars");
|
for (String line: lines) {
|
||||||
for (String var : vars.split("&")) {
|
if (line.contains("html5player.setVideoUrlHigh")) {
|
||||||
if (var.startsWith("flv_url=")) {
|
String videoURL = line.replaceAll("\t", "").replaceAll("html5player.setVideoUrlHigh\\(", "").replaceAll("\'", "").replaceAll("\\);", "");
|
||||||
String vidUrl = var.substring("flv_url=".length());
|
addURLToDownload(new URL(videoURL), HOST + "_" + getGID(this.url));
|
||||||
vidUrl = URLDecoder.decode(vidUrl, "UTF-8");
|
waitForThreads();
|
||||||
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
waitForThreads();
|
throw new IOException("Unable to find video url at " + this.url.toExternalForm());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user