From a59c2a35773054ff32ca9997194465822ecfb1be Mon Sep 17 00:00:00 2001 From: TiA4f8R <74829229+TiA4f8R@users.noreply.github.com> Date: Wed, 2 Jun 2021 21:44:51 +0200 Subject: [PATCH] Catch every exception instead of only IOException and ExtractionException and add a Javadoc Catch every exception instead of only IOException and ExtractionException. Add JavaDoc for fetchAndroidMobileJsonPlayer method of YoutubeStreamExtractor --- .../youtube/extractors/YoutubeStreamExtractor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 0acf317e..d0d27fe1 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -819,6 +819,12 @@ public class YoutubeStreamExtractor extends StreamExtractor { } } + /** + * Fetch the Android Mobile API or fallback to the desktop streams. + * If something went wrong when parsing this API, fallback to the desktop JSON player, fetched + * again if the {@code signatureTimestamp} of the JS player is unknown (because signatures + * without a {@code signatureTimestamp} included in the player request are invalid). + */ private void fetchAndroidMobileJsonPlayer(final ContentCountry contentCountry, final Localization localization, final String videoId, @@ -833,7 +839,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { try { mobilePlayerResponse = getJsonMobilePostResponse("player", mobileBody, contentCountry, localization); - } catch (final IOException | ExtractionException ignored) { + } catch (final Exception ignored) { } if (mobilePlayerResponse != null && mobilePlayerResponse.has("streamingData")) { final JsonObject mobileStreamingData = mobilePlayerResponse.getObject(