Adress requested changes

This commit is contained in:
TiA4f8R 2021-06-05 18:17:26 +02:00
parent 54d4551ca6
commit 34a9ccb0fd
No known key found for this signature in database
GPG Key ID: E6D3E7F5949450DD

View File

@ -401,15 +401,15 @@ public class YoutubeParsingHelper {
try { try {
key = Parser.matchGroup1("INNERTUBE_API_KEY\":\"([0-9a-zA-Z_-]+?)\"", html); key = Parser.matchGroup1("INNERTUBE_API_KEY\":\"([0-9a-zA-Z_-]+?)\"", html);
keyAndVersionExtracted = true; } catch (final Parser.RegexException e1) {
} catch (final Parser.RegexException e) {
try { try {
key = Parser.matchGroup1("innertubeApiKey\":\"([0-9a-zA-Z_-]+?)\"", html); key = Parser.matchGroup1("innertubeApiKey\":\"([0-9a-zA-Z_-]+?)\"", html);
keyAndVersionExtracted = true; } catch (final Parser.RegexException e2) {
} catch (final Parser.RegexException ignored) { keyAndVersionExtracted = false;
throw new ParsingException("Could not extract client version and key");
} }
} }
keyAndVersionExtracted = false; keyAndVersionExtracted = true;
} }
/** /**
@ -422,7 +422,6 @@ public class YoutubeParsingHelper {
} }
if (!keyAndVersionExtracted) extractClientVersionAndKey(); if (!keyAndVersionExtracted) extractClientVersionAndKey();
if (isNullOrEmpty(key)) throw new ParsingException("Could not extract client version");
return clientVersion; return clientVersion;
} }
@ -434,7 +433,6 @@ public class YoutubeParsingHelper {
if (areHardcodedClientVersionAndKeyValid()) return key = HARDCODED_KEY; if (areHardcodedClientVersionAndKeyValid()) return key = HARDCODED_KEY;
if (!keyAndVersionExtracted) extractClientVersionAndKey(); if (!keyAndVersionExtracted) extractClientVersionAndKey();
if (isNullOrEmpty(key)) throw new ParsingException("Could not extract key");
return key; return key;
} }