Skip to content

Commit fa57ec0

Browse files
committed
Code improvements
* Throw ContentNotSupportedExceptions when extracting (as was done before)
1 parent ff8eb68 commit fa57ec0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/dashmanifestcreator/YoutubeOtfDashManifestCreator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ public String generateManifest() {
5050
// Get all durations and repetitions which are separated by a comma
5151
.split(",");
5252
final int lastIndex = segmentsAndDurationsResponseSplit.length - 1;
53-
if (isBlank(segmentsAndDurationsResponseSplit[lastIndex])) {
54-
segmentDurations = Arrays.copyOf(segmentsAndDurationsResponseSplit, lastIndex);
55-
} else {
56-
segmentDurations = segmentsAndDurationsResponseSplit;
57-
}
53+
segmentDurations = isBlank(segmentsAndDurationsResponseSplit[lastIndex])
54+
? Arrays.copyOf(segmentsAndDurationsResponseSplit, lastIndex)
55+
: segmentsAndDurationsResponseSplit;
5856
} catch (final Exception e) {
5957
throw new DashManifestCreationException("Could not get segment durations", e);
6058
}

extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,17 @@ private static void extractStreams(final StreamInfo streamInfo,
523523
/* Extract video stream url */
524524
try {
525525
streamInfo.setVideoStreams(extractor.getVideoStreams());
526+
} catch (final ContentNotSupportedException e) {
527+
throw e;
526528
} catch (final Exception e) {
527529
streamInfo.addError(new ExtractionException("Couldn't get video streams", e));
528530
}
529531

530532
/* Extract video only stream url */
531533
try {
532534
streamInfo.setVideoOnlyStreams(extractor.getVideoOnlyStreams());
535+
} catch (final ContentNotSupportedException e) {
536+
throw e;
533537
} catch (final Exception e) {
534538
streamInfo.addError(new ExtractionException("Couldn't get video only streams", e));
535539
}

0 commit comments

Comments
 (0)