Skip to content

Commit 34a9ccb

Browse files
committed
Adress requested changes
1 parent 54d4551 commit 34a9ccb

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,15 @@ private static void extractClientVersionAndKey() throws IOException, ExtractionE
401401

402402
try {
403403
key = Parser.matchGroup1("INNERTUBE_API_KEY\":\"([0-9a-zA-Z_-]+?)\"", html);
404-
keyAndVersionExtracted = true;
405-
} catch (final Parser.RegexException e) {
404+
} catch (final Parser.RegexException e1) {
406405
try {
407406
key = Parser.matchGroup1("innertubeApiKey\":\"([0-9a-zA-Z_-]+?)\"", html);
408-
keyAndVersionExtracted = true;
409-
} catch (final Parser.RegexException ignored) {
407+
} catch (final Parser.RegexException e2) {
408+
keyAndVersionExtracted = false;
409+
throw new ParsingException("Could not extract client version and key");
410410
}
411411
}
412-
keyAndVersionExtracted = false;
412+
keyAndVersionExtracted = true;
413413
}
414414

415415
/**
@@ -422,7 +422,6 @@ public static String getClientVersion() throws IOException, ExtractionException
422422
}
423423

424424
if (!keyAndVersionExtracted) extractClientVersionAndKey();
425-
if (isNullOrEmpty(key)) throw new ParsingException("Could not extract client version");
426425
return clientVersion;
427426
}
428427

@@ -434,7 +433,6 @@ public static String getKey() throws IOException, ExtractionException {
434433
if (areHardcodedClientVersionAndKeyValid()) return key = HARDCODED_KEY;
435434

436435
if (!keyAndVersionExtracted) extractClientVersionAndKey();
437-
if (isNullOrEmpty(key)) throw new ParsingException("Could not extract key");
438436
return key;
439437
}
440438

0 commit comments

Comments
 (0)