1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-10 07:54:02 +02:00

sanitizeURL added to jpg3 ripper to handle when link to other than the first page of the album is inputted

This commit is contained in:
georgi marinov
2023-12-13 14:06:24 +02:00
committed by soloturn
parent 81a77f09f8
commit e185b2acf3

View File

@@ -7,6 +7,7 @@ import org.jsoup.nodes.Element;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
@@ -39,6 +40,14 @@ public class Jpg3Ripper extends AbstractHTMLRipper {
return urls;
}
@Override
public URL sanitizeURL(URL url) throws MalformedURLException {
String u = url.toExternalForm();
u = u.replaceAll("https?://jpg3.su/a/([^/]+)/?.*", "https://jpg3.su/a/$1");
LOGGER.debug("Changed URL from " + url + " to " + u);
return new URL(u);
}
@Override
public Document getNextPage(Document page) throws IOException, URISyntaxException {
String href = page.select("[data-pagination='next']").attr("href");