[YouTube] Handle videos with no views or with "Recommended to you" text

This commit is contained in:
Mauricio Colli 2020-02-29 18:02:00 -03:00 committed by TobiGr
parent da2c562eb0
commit 2a470ac4f7
1 changed files with 6 additions and 0 deletions

View File

@ -203,6 +203,12 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
final String viewCount = getTextFromObject(viewCountObject);
if (viewCount.toLowerCase().contains("no views")) {
return 0;
} else if (viewCount.toLowerCase().contains("recommended")) {
return -1;
}
return Long.parseLong(Utils.removeNonDigitCharacters(viewCount));
} catch (Exception e) {
throw new ParsingException("Could not get view count", e);