Skip to content

Commit 5219a70

Browse files
authored
Merge pull request TeamNewPipe#864 from AudricV/fetch-android-client-for-ended/post-livestreams
[YouTube] Fetch the ANDROID client for ended/post livestreams
2 parents a26bcc5 + 090debd commit 5219a70

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,16 @@ public void onFetchPage(@Nonnull final Downloader downloader)
823823
.getBytes(StandardCharsets.UTF_8);
824824
nextResponse = getJsonPostResponse(NEXT, body, localization);
825825

826-
if ((!isAgeRestricted && streamType == StreamType.VIDEO_STREAM)
826+
// streamType can only have LIVE_STREAM, POST_LIVE_STREAM and VIDEO_STREAM values (see
827+
// setStreamType()), so this block will be run only for POST_LIVE_STREAM and VIDEO_STREAM
828+
// values if fetching of the ANDROID client is not forced
829+
if ((!isAgeRestricted && streamType != StreamType.LIVE_STREAM)
827830
|| isAndroidClientFetchForced) {
828831
try {
829832
fetchAndroidMobileJsonPlayer(contentCountry, localization, videoId);
830833
} catch (final Exception ignored) {
834+
// Ignore exceptions related to ANDROID client fetch or parsing, as it is not
835+
// compulsory to play contents
831836
}
832837
}
833838

@@ -836,6 +841,8 @@ public void onFetchPage(@Nonnull final Downloader downloader)
836841
try {
837842
fetchIosMobileJsonPlayer(contentCountry, localization, videoId);
838843
} catch (final Exception ignored) {
844+
// Ignore exceptions related to IOS client fetch or parsing, as it is not
845+
// compulsory to play contents
839846
}
840847
}
841848
}

0 commit comments

Comments
 (0)