mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-06 22:06:48 +02:00
Just a few minor changes here and there
This commit is contained in:
@@ -50,6 +50,7 @@ public class CfakeRipper extends AbstractHTMLRipper {
|
|||||||
@Override
|
@Override
|
||||||
public Document getNextPage(Document doc) throws IOException {
|
public Document getNextPage(Document doc) throws IOException {
|
||||||
// Find next page
|
// Find next page
|
||||||
|
@SuppressWarnings("unused")
|
||||||
String nextUrl = "";
|
String nextUrl = "";
|
||||||
// We use comic-nav-next to the find the next page
|
// We use comic-nav-next to the find the next page
|
||||||
Element elem = doc.select("td > div.next > a").first();
|
Element elem = doc.select("td > div.next > a").first();
|
||||||
|
@@ -59,6 +59,7 @@ public class ErofusRipper extends AbstractHTMLRipper {
|
|||||||
public List<String> getURLsFromPage(Document page) {
|
public List<String> getURLsFromPage(Document page) {
|
||||||
logger.info(page);
|
logger.info(page);
|
||||||
List<String> imageURLs = new ArrayList<>();
|
List<String> imageURLs = new ArrayList<>();
|
||||||
|
@SuppressWarnings("unused")
|
||||||
int x = 1;
|
int x = 1;
|
||||||
if (pageContainsImages(page)) {
|
if (pageContainsImages(page)) {
|
||||||
logger.info("Page contains images");
|
logger.info("Page contains images");
|
||||||
|
@@ -110,6 +110,7 @@ public class HentaiNexusRipper extends AbstractJSONRipper {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public String decodeJsonString(String jsonEncodedString)
|
public String decodeJsonString(String jsonEncodedString)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -120,6 +121,7 @@ public class HentaiNexusRipper extends AbstractJSONRipper {
|
|||||||
|
|
||||||
byte[] jsonBytes = Base64.getDecoder().decode(jsonEncodedString);
|
byte[] jsonBytes = Base64.getDecoder().decode(jsonEncodedString);
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
ArrayList unknownArray = new ArrayList();
|
ArrayList unknownArray = new ArrayList();
|
||||||
ArrayList<Integer> indexesToUse = new ArrayList<>();
|
ArrayList<Integer> indexesToUse = new ArrayList<>();
|
||||||
|
|
||||||
|
@@ -143,6 +143,7 @@ public class ImagebamRipper extends AbstractHTMLRipper {
|
|||||||
.get();
|
.get();
|
||||||
|
|
||||||
// Find image
|
// Find image
|
||||||
|
@SuppressWarnings("unused")
|
||||||
Elements metaTags = doc.getElementsByTag("meta");
|
Elements metaTags = doc.getElementsByTag("meta");
|
||||||
|
|
||||||
String imgsrc = "";//initialize, so no NullPointerExceptions should ever happen.
|
String imgsrc = "";//initialize, so no NullPointerExceptions should ever happen.
|
||||||
|
@@ -308,7 +308,7 @@ public class ImagefapRipper extends AbstractHTMLRipper {
|
|||||||
} else if(duration / 1000 < 300){
|
} else if(duration / 1000 < 300){
|
||||||
logger.debug("Rate limit: " + (rateLimitFiveMinutes - callsMade) + " calls remaining for first 5 minute mark.");
|
logger.debug("Rate limit: " + (rateLimitFiveMinutes - callsMade) + " calls remaining for first 5 minute mark.");
|
||||||
} else if(duration / 1000 < 3600){
|
} 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;
|
return duration;
|
||||||
|
@@ -12,7 +12,6 @@ import org.jsoup.nodes.Document;
|
|||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||||
import com.rarchives.ripme.utils.Http;
|
|
||||||
|
|
||||||
public class ImgboxRipper extends AbstractHTMLRipper {
|
public class ImgboxRipper extends AbstractHTMLRipper {
|
||||||
|
|
||||||
|
@@ -12,7 +12,6 @@ import org.jsoup.nodes.Document;
|
|||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||||
import com.rarchives.ripme.utils.Http;
|
|
||||||
|
|
||||||
public class KingcomixRipper extends AbstractHTMLRipper {
|
public class KingcomixRipper extends AbstractHTMLRipper {
|
||||||
|
|
||||||
|
@@ -3,11 +3,6 @@ package com.rarchives.ripme.ripper.rippers;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
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 class PawooRipper extends MastodonRipper {
|
||||||
public PawooRipper(URL url) throws IOException {
|
public PawooRipper(URL url) throws IOException {
|
||||||
super(url);
|
super(url);
|
||||||
|
@@ -12,7 +12,7 @@ import org.jsoup.nodes.Document;
|
|||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||||
import com.rarchives.ripme.utils.Http;
|
//import com.rarchives.ripme.utils.Http;
|
||||||
|
|
||||||
public class PorncomixRipper extends AbstractHTMLRipper {
|
public class PorncomixRipper extends AbstractHTMLRipper {
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ public class PorncomixinfoRipper extends AbstractHTMLRipper {
|
|||||||
@Override
|
@Override
|
||||||
public Document getNextPage(Document doc) throws IOException {
|
public Document getNextPage(Document doc) throws IOException {
|
||||||
// Find next page
|
// Find next page
|
||||||
String nextUrl = "";
|
// String nextUrl = "";
|
||||||
// We use comic-nav-next to the find the next page
|
// We use comic-nav-next to the find the next page
|
||||||
Element elem = doc.select("a.next_page").first();
|
Element elem = doc.select("a.next_page").first();
|
||||||
if (elem == null) {
|
if (elem == null) {
|
||||||
|
@@ -15,6 +15,7 @@ import static j2html.TagCreator.title;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
@@ -33,8 +34,9 @@ import org.json.JSONException;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
import org.json.JSONTokener;
|
||||||
import org.jsoup.Jsoup;
|
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.RipStatusMessage;
|
||||||
import com.rarchives.ripme.ui.UpdateUtils;
|
import com.rarchives.ripme.ui.UpdateUtils;
|
||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
@@ -45,7 +47,7 @@ import j2html.TagCreator;
|
|||||||
import j2html.tags.ContainerTag;
|
import j2html.tags.ContainerTag;
|
||||||
import j2html.tags.specialized.DivTag;
|
import j2html.tags.specialized.DivTag;
|
||||||
|
|
||||||
public class RedditRipper extends AlbumRipper {
|
public class RedditRipper extends AbstractHTMLRipper{
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(RedditRipper.class);
|
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_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; } });";
|
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'");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -146,7 +146,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addCheckboxListener(JCheckBox checkBox, String configString) {
|
private static void addCheckboxListener(JCheckBox checkBox, String configString) {
|
||||||
checkBox.addActionListener(arg0 -> {
|
checkBox.addActionListener(_ -> {
|
||||||
Utils.setConfigBoolean(configString, checkBox.isSelected());
|
Utils.setConfigBoolean(configString, checkBox.isSelected());
|
||||||
Utils.configureLogger();
|
Utils.configureLogger();
|
||||||
});
|
});
|
||||||
@@ -798,7 +798,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stopButton.addActionListener(event -> {
|
stopButton.addActionListener(_ -> {
|
||||||
if (ripper != null) {
|
if (ripper != null) {
|
||||||
ripper.stop();
|
ripper.stop();
|
||||||
isRipping = false;
|
isRipping = false;
|
||||||
@@ -880,7 +880,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
pack();
|
pack();
|
||||||
});
|
});
|
||||||
|
|
||||||
historyButtonRemove.addActionListener(event -> {
|
historyButtonRemove.addActionListener(_ -> {
|
||||||
int[] indices = historyTable.getSelectedRows();
|
int[] indices = historyTable.getSelectedRows();
|
||||||
for (int i = indices.length - 1; i >= 0; i--) {
|
for (int i = indices.length - 1; i >= 0; i--) {
|
||||||
int modelIndex = historyTable.convertRowIndexToModel(indices[i]);
|
int modelIndex = historyTable.convertRowIndexToModel(indices[i]);
|
||||||
@@ -894,7 +894,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
saveHistory();
|
saveHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
historyButtonClear.addActionListener(event -> {
|
historyButtonClear.addActionListener(_ -> {
|
||||||
if (Utils.getConfigBoolean("history.warn_before_delete", true)) {
|
if (Utils.getConfigBoolean("history.warn_before_delete", true)) {
|
||||||
|
|
||||||
JPanel checkChoise = new JPanel();
|
JPanel checkChoise = new JPanel();
|
||||||
@@ -912,8 +912,8 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
frame.setSize(405, 70);
|
frame.setSize(405, 70);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
frame.setLocationRelativeTo(null);
|
frame.setLocationRelativeTo(null);
|
||||||
noButton.addActionListener(e -> frame.setVisible(false));
|
noButton.addActionListener(_ -> frame.setVisible(false));
|
||||||
yesButton.addActionListener(ed -> {
|
yesButton.addActionListener(_ -> {
|
||||||
frame.setVisible(false);
|
frame.setVisible(false);
|
||||||
Utils.clearURLHistory();
|
Utils.clearURLHistory();
|
||||||
HISTORY.clear();
|
HISTORY.clear();
|
||||||
|
@@ -252,7 +252,7 @@ public class Http {
|
|||||||
SSLContext sslContext = SSLContext.getInstance("SSL");
|
SSLContext sslContext = SSLContext.getInstance("SSL");
|
||||||
sslContext.init(null, trustAllCerts, new SecureRandom());
|
sslContext.init(null, trustAllCerts, new SecureRandom());
|
||||||
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
|
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
|
||||||
HostnameVerifier allHostsValid = (hostname, session) -> true;
|
HostnameVerifier allHostsValid = (_, _) -> true;
|
||||||
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
|
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("ignoreSSLVerification() failed.");
|
logger.error("ignoreSSLVerification() failed.");
|
||||||
|
@@ -8,8 +8,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.rippers.DeviantartRipper;
|
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.Assertions;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -50,11 +48,6 @@ public class DeviantartRipperTest extends RippersTest {
|
|||||||
@Disabled("Broken ripper")
|
@Disabled("Broken ripper")
|
||||||
public void testGetGalleryIDAndUsername() throws IOException, URISyntaxException {
|
public void testGetGalleryIDAndUsername() throws IOException, URISyntaxException {
|
||||||
URL url = new URI("https://www.deviantart.com/airgee/gallery/").toURL();
|
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
|
@Test
|
||||||
|
Reference in New Issue
Block a user