Catch NumberFormatException instead of checking whether viewCount equals "Recommended for you"

This commit is contained in:
wb9688 2020-02-29 21:28:38 +01:00
parent 3e4d2fd64e
commit 2807079531
1 changed files with 3 additions and 1 deletions

View File

@ -195,8 +195,10 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
return -1;
}
String viewCount = getTextFromObject(videoInfo.getObject("viewCountText"));
if (viewCount.equals("Recommended for you")) return -1;
return Long.parseLong(Utils.removeNonDigitCharacters(viewCount));
} catch (NumberFormatException e) {
return -1;
} catch (Exception e) {
throw new ParsingException("Could not get view count", e);
}