From a8dd989d3739bf1aa4ef9376aad519ca5592e6cd Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Fri, 15 Jun 2018 16:03:02 -0400 Subject: [PATCH 1/2] Furaffinity ripper now uses RipUtils.getCookiesFromString to get cookies from config file --- .../ripme/ripper/rippers/FuraffinityRipper.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 7dd5b731..54fb3292 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java @@ -26,6 +26,8 @@ import com.rarchives.ripme.ripper.AbstractHTMLRipper; import com.rarchives.ripme.ripper.DownloadThreadPool; import com.rarchives.ripme.utils.Http; +import static com.rarchives.ripme.utils.RipUtils.getCookiesFromString; + public class FuraffinityRipper extends AbstractHTMLRipper { private static final String urlBase = "https://www.furaffinity.net"; @@ -34,16 +36,14 @@ public class FuraffinityRipper extends AbstractHTMLRipper { private void setCookies() { if (Utils.getConfigBoolean("furaffinity.login", true)) { LOGGER.info("Logging in using cookies"); - 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); + String faCookies = Utils.getConfigString("furaffinity.cookies", "a=897bc45b-1f87-49f1-8a85-9412bc103e7a;b=c8807f36-7a85-4caf-80ca-01c2a2368267"); + warnAboutSharedAccount(faCookies); + cookies = getCookiesFromString(faCookies); } } - private void warnAboutSharedAccount(String a, String b) { - if (a.equals("897bc45b-1f87-49f1-8a85-9412bc103e7a") && b.equals("c8807f36-7a85-4caf-80ca-01c2a2368267")) { + private void warnAboutSharedAccount(String loginCookies) { + if (loginCookies.equals("a=897bc45b-1f87-49f1-8a85-9412bc103e7a;b=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"); } From 963ae7460abd309e7c2069d9754956f404e586bf Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Fri, 15 Jun 2018 16:03:31 -0400 Subject: [PATCH 2/2] Added unittest for logging in to Furaffinity --- .../ripme/tst/ripper/rippers/FuraffinityRipperTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java index 90d66ecd..4982b40f 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/FuraffinityRipperTest.java @@ -16,4 +16,12 @@ public class FuraffinityRipperTest extends RippersTest { FuraffinityRipper ripper = new FuraffinityRipper(url); assertEquals("mustardgas", ripper.getGID(url)); } + + public void testLogin() throws IOException { + URL url = new URL("https://www.furaffinity.net/gallery/mustardgas/"); + FuraffinityRipper ripper = new FuraffinityRipper(url); + // Check if the first page contain the username of ripmes shared account + Boolean containsUsername = ripper.getFirstPage().html().contains("ripmethrowaway"); + assert containsUsername; + } }