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 bd1bbd253a..51ae6c511b 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 @@ -1050,6 +1050,10 @@ private Map getItags(final String streamingDataKey, @Override public List getFrames() throws ExtractionException { try { + if (!playerResponse.has("storyboards")) { + // this might be the case when the video is very short + return Collections.emptyList(); + } final JsonObject storyboards = playerResponse.getObject("storyboards"); final JsonObject storyboardsRenderer; if (storyboards.has("playerLiveStoryboardSpecRenderer")) { @@ -1081,10 +1085,13 @@ public List getFrames() throws ExtractionException { final int totalCount = Integer.parseInt(parts[2]); final int framesPerPageX = Integer.parseInt(parts[3]); final int framesPerPageY = Integer.parseInt(parts[4]); - final String baseUrl = url.replace("$L", String.valueOf(i - 1)).replace("$N", parts[6]) + "&sigh=" + parts[7]; + final String baseUrl = url + .replace("$L", String.valueOf(i - 1)) + .replace("$N", parts[6]) + "&sigh=" + parts[7]; final List urls; if (baseUrl.contains("$M")) { - final int totalPages = (int) Math.ceil(totalCount / (double) (framesPerPageX * framesPerPageY)); + final int totalPages = + (int) Math.ceil(totalCount / (double) (framesPerPageX * framesPerPageY)); urls = new ArrayList<>(totalPages); for (int j = 0; j < totalPages; j++) { urls.add(baseUrl.replace("$M", String.valueOf(j)));