Skip to content

Commit 2807079

Browse files
committed
Catch NumberFormatException instead of checking whether viewCount equals "Recommended for you"
1 parent 3e4d2fd commit 2807079

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ public long getViewCount() throws ParsingException {
195195
return -1;
196196
}
197197
String viewCount = getTextFromObject(videoInfo.getObject("viewCountText"));
198-
if (viewCount.equals("Recommended for you")) return -1;
198+
199199
return Long.parseLong(Utils.removeNonDigitCharacters(viewCount));
200+
} catch (NumberFormatException e) {
201+
return -1;
200202
} catch (Exception e) {
201203
throw new ParsingException("Could not get view count", e);
202204
}

0 commit comments

Comments
 (0)