From 1b5b58ebb4d7575feeafadc98c1b7d03d6759c5f Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Fri, 8 Jun 2018 16:52:33 -0400 Subject: [PATCH 1/4] Removed shared account due to privacy concerns --- .../ripme/ripper/rippers/FuraffinityRipper.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java index 440e9ae5..ed42ffcc 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java @@ -29,8 +29,11 @@ public class FuraffinityRipper extends AbstractHTMLRipper { private static final String urlBase = "https://www.furaffinity.net"; private static Map cookies = new HashMap<>(); static { - cookies.put("b", "bd5ccac8-51dc-4265-8ae1-7eac685ad667"); - cookies.put("a", "7c41b782-d01d-4b0e-b45b-62a4f0b2a369"); + if (Utils.getConfigString("furaffinity.cookie.a", "") != "" && Utils.getConfigString("furaffinity.cookie.b", "") != "") { + LOGGER.info("Logging in using cookies"); + cookies.put("b", Utils.getConfigString("furaffinity.cookie.b", "")); + cookies.put("a", Utils.getConfigString("furaffinity.cookie.a", "")); + } } // Thread pool for finding direct image links from "image" pages (html) @@ -91,9 +94,12 @@ public class FuraffinityRipper extends AbstractHTMLRipper { @Override public List getURLsFromPage(Document page) { List urls = new ArrayList<>(); - Elements urlElements = page.select("figure.t-image > b > u > a"); + Elements urlElements = page.select("figure > b > u > a"); for (Element e : urlElements) { - urls.add(getImageFromPost(urlBase + e.select("a").first().attr("href"))); + String urlToAdd = getImageFromPost(urlBase + e.select("a").first().attr("href")); + if (urlToAdd.startsWith("http")) { + urls.add(urlToAdd); + } } return urls; } From cbd1372ba4c02ae221f35978189547402f12e6fd Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Sat, 9 Jun 2018 02:46:46 -0400 Subject: [PATCH 2/4] Readded shared account cookies; added option to not login to Furaffinity when ripping --- .../ripper/rippers/FuraffinityRipper.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java index ed42ffcc..2131567b 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java @@ -29,10 +29,10 @@ public class FuraffinityRipper extends AbstractHTMLRipper { private static final String urlBase = "https://www.furaffinity.net"; private static Map cookies = new HashMap<>(); static { - if (Utils.getConfigString("furaffinity.cookie.a", "") != "" && Utils.getConfigString("furaffinity.cookie.b", "") != "") { + if (Utils.getConfigBoolean("furaffinity.login", true)) { LOGGER.info("Logging in using cookies"); - cookies.put("b", Utils.getConfigString("furaffinity.cookie.b", "")); - cookies.put("a", Utils.getConfigString("furaffinity.cookie.a", "")); + cookies.put("a", Utils.getConfigString("furaffinity.cookie.a", "897bc45b-1f87-49f1-8a85-9412bc103e7a")); + cookies.put("b", Utils.getConfigString("furaffinity.cookie.b", "c8807f36-7a85-4caf-80ca-01c2a2368267")); } } @@ -97,7 +97,7 @@ public class FuraffinityRipper extends AbstractHTMLRipper { Elements urlElements = page.select("figure > b > u > a"); for (Element e : urlElements) { String urlToAdd = getImageFromPost(urlBase + e.select("a").first().attr("href")); - if (urlToAdd.startsWith("http")) { + if (urlToAdd.startsWith("http") && urlToAdd.contains("/view/")) { urls.add(urlToAdd); } } @@ -206,16 +206,5 @@ public class FuraffinityRipper extends AbstractHTMLRipper { + " instead"); } - private class FuraffinityDocumentThread extends Thread { - private URL url; - - FuraffinityDocumentThread(URL url) { - super(); - this.url = url; - } - - - } - } \ No newline at end of file From a753b016f622999926f4fbf4c5c90f62d4563a59 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Sat, 9 Jun 2018 03:01:32 -0400 Subject: [PATCH 3/4] Ripme now warns users about using the shared Furaffinity account --- .../ripper/rippers/FuraffinityRipper.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java index 2131567b..eecde5dd 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java @@ -12,6 +12,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.rarchives.ripme.ui.RipStatusMessage; import com.rarchives.ripme.utils.Utils; import org.jsoup.Connection.Response; import org.jsoup.Jsoup; @@ -27,12 +28,23 @@ import com.rarchives.ripme.utils.Http; public class FuraffinityRipper extends AbstractHTMLRipper { private static final String urlBase = "https://www.furaffinity.net"; - private static Map cookies = new HashMap<>(); - static { + private Map cookies = new HashMap<>(); + + private void setCookies() { if (Utils.getConfigBoolean("furaffinity.login", true)) { LOGGER.info("Logging in using cookies"); - cookies.put("a", Utils.getConfigString("furaffinity.cookie.a", "897bc45b-1f87-49f1-8a85-9412bc103e7a")); - cookies.put("b", Utils.getConfigString("furaffinity.cookie.b", "c8807f36-7a85-4caf-80ca-01c2a2368267")); + String faACookie = Utils.getConfigString("furaffinity.cookie.a", "897bc45b-1f87-49f1-8a85-9412bc103e7a"); + String faBCookie = Utils.getConfigString("furaffinity.cookie.b", "c8807f36-7a85-4caf-80ca-01c2a2368267"); + warnAboutSharedAccount(faACookie, faBCookie); + cookies.put("a", faACookie); + cookies.put("b", faBCookie); + } + } + + private void warnAboutSharedAccount(String a, String b) { + if (a.equals("897bc45b-1f87-49f1-8a85-9412bc103e7a") && b.equals("c8807f36-7a85-4caf-80ca-01c2a2368267")) { + sendUpdate(RipStatusMessage.STATUS.DOWNLOAD_ERRORED, + "WARNING: Using the shared furaffinity account exposes both your IP and how many items you downloaded to the other users of the share account"); } } @@ -64,6 +76,7 @@ public class FuraffinityRipper extends AbstractHTMLRipper { } @Override public Document getFirstPage() throws IOException { + setCookies(); return Http.url(url).cookies(cookies).get(); } From 00f1b8a5e9c0fafbc38f495dffc831afe20306d6 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Mon, 11 Jun 2018 08:31:47 -0400 Subject: [PATCH 4/4] FurAffinityRipper now downloads fullsized images and NSFW images --- .../ripper/rippers/FuraffinityRipper.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java index eecde5dd..7dd5b731 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java @@ -15,6 +15,7 @@ import java.util.regex.Pattern; import com.rarchives.ripme.ui.RipStatusMessage; import com.rarchives.ripme.utils.Utils; import org.jsoup.Connection.Response; +import org.jsoup.HttpStatusException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -77,6 +78,7 @@ public class FuraffinityRipper extends AbstractHTMLRipper { @Override public Document getFirstPage() throws IOException { setCookies(); + LOGGER.info(Http.url(url).cookies(cookies).get().html()); return Http.url(url).cookies(cookies).get(); } @@ -96,22 +98,33 @@ public class FuraffinityRipper extends AbstractHTMLRipper { } private String getImageFromPost(String url) { + sleep(1000); + Document d = null; try { - LOGGER.info("found url " + Http.url(url).cookies(cookies).get().select("meta[property=og:image]").attr("content")); - return Http.url(url).cookies(cookies).get().select("meta[property=og:image]").attr("content"); + d = Http.url(url).cookies(cookies).get(); + Elements links = d.getElementsByTag("a"); + for (Element link : links) { + if (link.text().equals("Download")) { + LOGGER.info("Found image " + link.attr("href")); + return "https:" + link.attr("href"); + } + } } catch (IOException e) { - return ""; + return null; } + return null; } @Override public List getURLsFromPage(Document page) { List urls = new ArrayList<>(); - Elements urlElements = page.select("figure > b > u > a"); + Elements urlElements = page.select("figure.t-image > b > u > a"); for (Element e : urlElements) { String urlToAdd = getImageFromPost(urlBase + e.select("a").first().attr("href")); - if (urlToAdd.startsWith("http") && urlToAdd.contains("/view/")) { - urls.add(urlToAdd); + if (url != null) { + if (urlToAdd.startsWith("http")) { + urls.add(urlToAdd); + } } } return urls;