Furaffinity ripper now uses RipUtils.getCookiesFromString to get cookies from config file

This commit is contained in:
cyian-1756 2018-06-15 16:03:02 -04:00
parent a1996cc01e
commit a8dd989d37

View File

@ -26,6 +26,8 @@ import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.ripper.DownloadThreadPool; import com.rarchives.ripme.ripper.DownloadThreadPool;
import com.rarchives.ripme.utils.Http; import com.rarchives.ripme.utils.Http;
import static com.rarchives.ripme.utils.RipUtils.getCookiesFromString;
public class FuraffinityRipper extends AbstractHTMLRipper { public class FuraffinityRipper extends AbstractHTMLRipper {
private static final String urlBase = "https://www.furaffinity.net"; private static final String urlBase = "https://www.furaffinity.net";
@ -34,16 +36,14 @@ public class FuraffinityRipper extends AbstractHTMLRipper {
private void setCookies() { private void setCookies() {
if (Utils.getConfigBoolean("furaffinity.login", true)) { if (Utils.getConfigBoolean("furaffinity.login", true)) {
LOGGER.info("Logging in using cookies"); LOGGER.info("Logging in using cookies");
String faACookie = Utils.getConfigString("furaffinity.cookie.a", "897bc45b-1f87-49f1-8a85-9412bc103e7a"); String faCookies = Utils.getConfigString("furaffinity.cookies", "a=897bc45b-1f87-49f1-8a85-9412bc103e7a;b=c8807f36-7a85-4caf-80ca-01c2a2368267");
String faBCookie = Utils.getConfigString("furaffinity.cookie.b", "c8807f36-7a85-4caf-80ca-01c2a2368267"); warnAboutSharedAccount(faCookies);
warnAboutSharedAccount(faACookie, faBCookie); cookies = getCookiesFromString(faCookies);
cookies.put("a", faACookie);
cookies.put("b", faBCookie);
} }
} }
private void warnAboutSharedAccount(String a, String b) { private void warnAboutSharedAccount(String loginCookies) {
if (a.equals("897bc45b-1f87-49f1-8a85-9412bc103e7a") && b.equals("c8807f36-7a85-4caf-80ca-01c2a2368267")) { if (loginCookies.equals("a=897bc45b-1f87-49f1-8a85-9412bc103e7a;b=c8807f36-7a85-4caf-80ca-01c2a2368267")) {
sendUpdate(RipStatusMessage.STATUS.DOWNLOAD_ERRORED, 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"); "WARNING: Using the shared furaffinity account exposes both your IP and how many items you downloaded to the other users of the share account");
} }