Fix addYoutubeCookies functions (Yt changed things lately)

This commit is contained in:
Stypox 2020-02-02 21:33:07 +01:00
parent f95d51b307
commit 6da9096176
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23

View file

@ -150,28 +150,17 @@ public class ReCaptchaActivity extends AppCompatActivity {
} }
private void addYoutubeCookies(@Nonnull String cookies) { private void addYoutubeCookies(@Nonnull String cookies) {
String c_s_gl = ""; if (cookies.contains("s_gl=") || cookies.contains("goojf=") || cookies.contains("VISITOR_INFO1_LIVE=")) {
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);
// Youtube seems to also need the other cookies: // Youtube seems to also need the other cookies:
addCookie(cookies); addCookie(cookies);
} }
} }
private void addCookie(String cookie) { private void addCookie(String cookie) {
if (foundCookies.contains(cookie)) {
return;
}
if (foundCookies.isEmpty() || foundCookies.endsWith("; ")) { if (foundCookies.isEmpty() || foundCookies.endsWith("; ")) {
foundCookies += cookie; foundCookies += cookie;
} else if (foundCookies.endsWith(";")) { } else if (foundCookies.endsWith(";")) {