1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-04-21 12:12:38 +02:00

Just a few minor changes here and there

This commit is contained in:
Sayanjit Mukherjee 2025-01-23 23:56:43 +05:30
parent c0f1e6eb0b
commit a63b91f01a
14 changed files with 37 additions and 26 deletions

View File

@ -50,6 +50,7 @@ public class CfakeRipper extends AbstractHTMLRipper {
@Override
public Document getNextPage(Document doc) throws IOException {
// Find next page
@SuppressWarnings("unused")
String nextUrl = "";
// We use comic-nav-next to the find the next page
Element elem = doc.select("td > div.next > a").first();

View File

@ -59,6 +59,7 @@ public class ErofusRipper extends AbstractHTMLRipper {
public List<String> getURLsFromPage(Document page) {
logger.info(page);
List<String> imageURLs = new ArrayList<>();
@SuppressWarnings("unused")
int x = 1;
if (pageContainsImages(page)) {
logger.info("Page contains images");

View File

@ -110,6 +110,7 @@ public class HentaiNexusRipper extends AbstractJSONRipper {
return "";
}
@SuppressWarnings("unchecked")
public String decodeJsonString(String jsonEncodedString)
{
/*
@ -120,6 +121,7 @@ public class HentaiNexusRipper extends AbstractJSONRipper {
byte[] jsonBytes = Base64.getDecoder().decode(jsonEncodedString);
@SuppressWarnings("rawtypes")
ArrayList unknownArray = new ArrayList();
ArrayList<Integer> indexesToUse = new ArrayList<>();

View File

@ -143,6 +143,7 @@ public class ImagebamRipper extends AbstractHTMLRipper {
.get();
// Find image
@SuppressWarnings("unused")
Elements metaTags = doc.getElementsByTag("meta");
String imgsrc = "";//initialize, so no NullPointerExceptions should ever happen.

View File

@ -308,7 +308,7 @@ public class ImagefapRipper extends AbstractHTMLRipper {
} else if(duration / 1000 < 300){
logger.debug("Rate limit: " + (rateLimitFiveMinutes - callsMade) + " calls remaining for first 5 minute mark.");
} else if(duration / 1000 < 3600){
logger.debug("Rate limit: " + (RATE_LIMIT_HOUR - callsMade) + " calls remaining for first hour mark.");
logger.debug("Rate limit: " + (rateLimitHour - callsMade) + " calls remaining for first hour mark.");
}
return duration;

View File

@ -12,7 +12,6 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.utils.Http;
public class ImgboxRipper extends AbstractHTMLRipper {

View File

@ -12,7 +12,6 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.utils.Http;
public class KingcomixRipper extends AbstractHTMLRipper {

View File

@ -3,11 +3,6 @@ package com.rarchives.ripme.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import com.rarchives.ripme.utils.Http;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class PawooRipper extends MastodonRipper {
public PawooRipper(URL url) throws IOException {
super(url);

View File

@ -12,7 +12,7 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.utils.Http;
//import com.rarchives.ripme.utils.Http;
public class PorncomixRipper extends AbstractHTMLRipper {

View File

@ -44,7 +44,7 @@ public class PorncomixinfoRipper extends AbstractHTMLRipper {
@Override
public Document getNextPage(Document doc) throws IOException {
// Find next page
String nextUrl = "";
// String nextUrl = "";
// We use comic-nav-next to the find the next page
Element elem = doc.select("a.next_page").first();
if (elem == null) {

View File

@ -15,6 +15,7 @@ import static j2html.TagCreator.title;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@ -33,8 +34,9 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import com.rarchives.ripme.ripper.AlbumRipper;
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.ui.RipStatusMessage;
import com.rarchives.ripme.ui.UpdateUtils;
import com.rarchives.ripme.utils.Http;
@ -45,7 +47,7 @@ import j2html.TagCreator;
import j2html.tags.ContainerTag;
import j2html.tags.specialized.DivTag;
public class RedditRipper extends AlbumRipper {
public class RedditRipper extends AbstractHTMLRipper{
private static final Logger logger = LogManager.getLogger(RedditRipper.class);
@ -532,4 +534,22 @@ public class RedditRipper extends AlbumRipper {
private static final String HTML_STYLING = " .author { font-weight: bold; } .op { color: blue; } .comment { border: 0px; margin: 0 0 25px; padding-left: 5px; } .child { margin: 2px 0 0 20px; border-left: 2px dashed #AAF; } .collapsed { background: darkgrey; margin-bottom: 0; } .collapsed > div { display: none; } .md { max-width: 840px; padding-right: 1em; } h1 { margin: 0; } body { position: relative; background-color: #eeeeec; color: #00000a; font-weight: 400; font-style: normal; font-variant: normal; font-family: Helvetica,Arial,sans-serif; line-height: 1.4 } blockquote { margin: 5px 5px 5px 15px; padding: 1px 1px 1px 15px; max-width: 60em; border: 1px solid #ccc; border-width: 0 0 0 1px; } pre { white-space: pre-wrap; } img, video { max-width: 60vw; max-height: 90vh; object-fit: contain; } .thing { overflow: hidden; margin: 0 5px 3px 40px; border: 1px solid #e0e0e0; background-color: #fcfcfb; } :target > .md { border: 5px solid blue; } .post { margin-bottom: 20px; margin-top: 20px; } .gold { background: goldenrod; } .silver { background: silver; } .platinum { background: aqua; } .deleted { background: #faa; } .md.deleted { background: inherit; border: 5px solid #faa; } .oppost { background-color: #EEF; } blockquote > p { margin: 0; } #related { max-height: 20em; overflow-y: scroll; background-color: #F4FFF4; } #related h3 { position: sticky; top: 0; background-color: white; } .flex { display: flex; flex-flow: wrap; flex-direction: row-reverse; justify-content: flex-end; } ";
private static final String HTML_SCRIPT = "document.addEventListener('mousedown', function(e) { var t = e.target; if (t.className == 'author') { t = t.parentElement; } if (t.classList.contains('comment')) { t.classList.toggle('collapsed'); e.preventDefault(); e.stopPropagation(); return false; } });";
@Override
protected String getDomain() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getDomain'");
}
@Override
protected List<String> getURLsFromPage(Document page) throws UnsupportedEncodingException, URISyntaxException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getURLsFromPage'");
}
@Override
protected void downloadURL(URL url, int index) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'downloadURL'");
}
}

View File

@ -146,7 +146,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
}
private static void addCheckboxListener(JCheckBox checkBox, String configString) {
checkBox.addActionListener(arg0 -> {
checkBox.addActionListener(_ -> {
Utils.setConfigBoolean(configString, checkBox.isSelected());
Utils.configureLogger();
});
@ -798,7 +798,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
}
});
stopButton.addActionListener(event -> {
stopButton.addActionListener(_ -> {
if (ripper != null) {
ripper.stop();
isRipping = false;
@ -880,7 +880,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
pack();
});
historyButtonRemove.addActionListener(event -> {
historyButtonRemove.addActionListener(_ -> {
int[] indices = historyTable.getSelectedRows();
for (int i = indices.length - 1; i >= 0; i--) {
int modelIndex = historyTable.convertRowIndexToModel(indices[i]);
@ -894,7 +894,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
saveHistory();
});
historyButtonClear.addActionListener(event -> {
historyButtonClear.addActionListener(_ -> {
if (Utils.getConfigBoolean("history.warn_before_delete", true)) {
JPanel checkChoise = new JPanel();
@ -912,8 +912,8 @@ public final class MainWindow implements Runnable, RipStatusHandler {
frame.setSize(405, 70);
frame.setVisible(true);
frame.setLocationRelativeTo(null);
noButton.addActionListener(e -> frame.setVisible(false));
yesButton.addActionListener(ed -> {
noButton.addActionListener(_ -> frame.setVisible(false));
yesButton.addActionListener(_ -> {
frame.setVisible(false);
Utils.clearURLHistory();
HISTORY.clear();

View File

@ -252,7 +252,7 @@ public class Http {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
HostnameVerifier allHostsValid = (hostname, session) -> true;
HostnameVerifier allHostsValid = (_, _) -> true;
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
} catch (Exception e) {
logger.error("ignoreSSLVerification() failed.");

View File

@ -8,8 +8,6 @@ import java.util.ArrayList;
import java.util.List;
import com.rarchives.ripme.ripper.rippers.DeviantartRipper;
import com.rarchives.ripme.utils.Http;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@ -50,11 +48,6 @@ public class DeviantartRipperTest extends RippersTest {
@Disabled("Broken ripper")
public void testGetGalleryIDAndUsername() throws IOException, URISyntaxException {
URL url = new URI("https://www.deviantart.com/airgee/gallery/").toURL();
DeviantartRipper ripper = new DeviantartRipper(url);
Document doc = Http.url(url).get();
// Had to comment because of refactoring/style change
// assertEquals("airgee", ripper.getUsername(doc));
// assertEquals("714589", ripper.getGalleryID(doc));
}
@Test