mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-18 19:51:35 +02:00
new URI instead of new URL, motherless, nfsfw.
This commit is contained in:
@@ -2,6 +2,8 @@ package com.rarchives.ripme.ripper.rippers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -66,13 +68,13 @@ public class MotherlessRipper extends AbstractHTMLRipper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getNextPage(Document doc) throws IOException {
|
||||
public Document getNextPage(Document doc) throws IOException, URISyntaxException {
|
||||
Elements nextPageLink = doc.head().select("link[rel=next]");
|
||||
if (nextPageLink.isEmpty()) {
|
||||
throw new IOException("Last page reached");
|
||||
} else {
|
||||
String referrerLink = doc.head().select("link[rel=canonical]").first().attr("href");
|
||||
URL nextURL = new URL(this.url, nextPageLink.first().attr("href"));
|
||||
URL nextURL = this.url.toURI().resolve(nextPageLink.first().attr("href")).toURL();
|
||||
return Http.url(nextURL).referrer(referrerLink).get();
|
||||
}
|
||||
}
|
||||
@@ -180,11 +182,11 @@ public class MotherlessRipper extends AbstractHTMLRipper {
|
||||
if (Utils.getConfigBoolean("download.save_order", true)) {
|
||||
prefix = String.format("%03d_", index);
|
||||
}
|
||||
addURLToDownload(new URL(file), prefix);
|
||||
addURLToDownload(new URI(file).toURL(), prefix);
|
||||
} else {
|
||||
LOGGER.warn("[!] could not find '__fileurl' at " + url);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
LOGGER.error("[!] Exception while loading/parsing " + this.url, e);
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@ package com.rarchives.ripme.ripper.rippers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -104,13 +106,13 @@ public class NfsfwRipper extends AbstractHTMLRipper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL sanitizeURL(URL url) throws MalformedURLException {
|
||||
public URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException {
|
||||
// always start on the first page of an album
|
||||
// (strip the options after the '?')
|
||||
String u = url.toExternalForm();
|
||||
if (u.contains("?")) {
|
||||
u = u.substring(0, u.indexOf("?"));
|
||||
return new URL(u);
|
||||
return new URI(u).toURL();
|
||||
} else {
|
||||
return url;
|
||||
}
|
||||
@@ -220,8 +222,8 @@ public class NfsfwRipper extends AbstractHTMLRipper {
|
||||
if (file.startsWith("/")) {
|
||||
file = "http://nfsfw.com" + file;
|
||||
}
|
||||
addURLToDownload(new URL(file), getPrefix(index), this.subdir);
|
||||
} catch (IOException e) {
|
||||
addURLToDownload(new URI(file).toURL(), getPrefix(index), this.subdir);
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
LOGGER.error("[!] Exception while loading/parsing " + this.url, e);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user