1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-17 04:38:18 +01:00

JPG3 (JPG Fish) ripper added

This commit is contained in:
joroto 2023-12-13 13:44:39 +02:00 committed by soloturn
parent 43ebb8d643
commit 81a77f09f8

View File

@ -0,0 +1,61 @@
package com.rarchives.ripme.ripper.rippers;
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.utils.Http;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class Jpg3Ripper extends AbstractHTMLRipper {
public Jpg3Ripper(URL url) throws IOException {
super(url);
}
@Override
public String getDomain() {
return "jpg3.su";
}
@Override
public String getHost() {
return "jpg3";
}
@Override
public List<String> getURLsFromPage(Document page) {
List<String> urls = new ArrayList<>();
for (Element el : page.select(".image-container > img")) {
urls.add(el.attr("src").replaceAll("\\.md", ""));
}
return urls;
}
@Override
public Document getNextPage(Document page) throws IOException, URISyntaxException {
String href = page.select("[data-pagination='next']").attr("href");
if (!href.isEmpty()) {
return Http.url(href).get();
} else {
return null;
}
}
@Override
public String getGID(URL url) throws MalformedURLException {
return url.toString().split("/")[url.toString().split("/").length - 1];
}
@Override
protected void downloadURL(URL url, int index) {
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), null);
}
}