From 6da90961762b92a2d9cae90e4b5879fdf481ce5a Mon Sep 17 00:00:00 2001 From: Stypox Date: Sun, 2 Feb 2020 21:33:07 +0100 Subject: [PATCH] Fix addYoutubeCookies functions (Yt changed things lately) --- .../org/schabi/newpipe/ReCaptchaActivity.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ReCaptchaActivity.java b/app/src/main/java/org/schabi/newpipe/ReCaptchaActivity.java index 8abcd2435..566e1fc76 100644 --- a/app/src/main/java/org/schabi/newpipe/ReCaptchaActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ReCaptchaActivity.java @@ -150,28 +150,17 @@ public class ReCaptchaActivity extends AppCompatActivity { } private void addYoutubeCookies(@Nonnull String cookies) { - String c_s_gl = ""; - String c_goojf = ""; - - String[] parts = cookies.split(";"); - for (String part : parts) { - String trimmedPart = part.trim(); - if (trimmedPart.startsWith("s_gl")) { - c_s_gl = trimmedPart; - } - if (trimmedPart.startsWith("goojf")) { - c_goojf = trimmedPart; - } - } - if (c_s_gl.length() > 0 && c_goojf.length() > 0) { - // addCookie(c_s_gl); - // addCookie(c_goojf); + if (cookies.contains("s_gl=") || cookies.contains("goojf=") || cookies.contains("VISITOR_INFO1_LIVE=")) { // Youtube seems to also need the other cookies: addCookie(cookies); } } private void addCookie(String cookie) { + if (foundCookies.contains(cookie)) { + return; + } + if (foundCookies.isEmpty() || foundCookies.endsWith("; ")) { foundCookies += cookie; } else if (foundCookies.endsWith(";")) {