From dd8687f9fe0dcc7289bfd86cddc1a904506b16d4 Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 1 Mar 2022 23:02:56 +0100 Subject: [PATCH] [YouTube] Fix music mixes in some countries --- .../extractor/services/youtube/YoutubeParsingHelper.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java index 48ffbac0..191dd0c3 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java @@ -988,10 +988,13 @@ public class YoutubeParsingHelper { public static String extractCookieValue(final String cookieName, @Nonnull final Response response) { final List cookies = response.responseHeaders().get("set-cookie"); - int startIndex; - String result = ""; + if (cookies == null) { + return EMPTY_STRING; + } + + String result = EMPTY_STRING; for (final String cookie : cookies) { - startIndex = cookie.indexOf(cookieName); + final int startIndex = cookie.indexOf(cookieName); if (startIndex != -1) { result = cookie.substring(startIndex + cookieName.length() + "=".length(), cookie.indexOf(";", startIndex));