mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-24 14:33:17 +02:00
new URI instead of new URL.
This commit is contained in:
@@ -2,6 +2,8 @@ package com.rarchives.ripme.ripper.rippers;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.jsoup.Connection.Response;
|
import org.jsoup.Connection.Response;
|
||||||
@@ -34,7 +36,7 @@ public class ArtstnRipper extends ArtStationRipper {
|
|||||||
if (artStationUrl == null) {
|
if (artStationUrl == null) {
|
||||||
throw new IOException("Null url received.");
|
throw new IOException("Null url received.");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
LOGGER.error("Couldnt resolve URL.", e);
|
LOGGER.error("Couldnt resolve URL.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public class ArtstnRipper extends ArtStationRipper {
|
|||||||
return super.getGID(artStationUrl);
|
return super.getGID(artStationUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public URL getFinalUrl(URL url) throws IOException {
|
public URL getFinalUrl(URL url) throws IOException, URISyntaxException {
|
||||||
if (url.getHost().endsWith("artstation.com")) {
|
if (url.getHost().endsWith("artstation.com")) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@@ -50,7 +52,7 @@ public class ArtstnRipper extends ArtStationRipper {
|
|||||||
LOGGER.info("Checking url: " + url);
|
LOGGER.info("Checking url: " + url);
|
||||||
Response response = Http.url(url).connection().followRedirects(false).execute();
|
Response response = Http.url(url).connection().followRedirects(false).execute();
|
||||||
if (response.statusCode() / 100 == 3 && response.hasHeader("location")) {
|
if (response.statusCode() / 100 == 3 && response.hasHeader("location")) {
|
||||||
return getFinalUrl(new URL(response.header("location")));
|
return getFinalUrl(new URI(response.header("location")).toURL());
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user