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
This commit is contained in:
TiA4f8R 2021-06-02 21:44:51 +02:00
parent 6921e80ded
commit a59c2a3577
No known key found for this signature in database
GPG Key ID: E6D3E7F5949450DD
1 changed files with 7 additions and 1 deletions

View File

@ -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(