mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-01-07 10:00:34 +05:30
[YouTube] Take into account videos that have their views hidden
Also remove catch because it may hide bugs when the page changes.
This commit is contained in:
parent
f66c20de54
commit
da2c562eb0
@ -194,11 +194,16 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
|
|||||||
if (videoInfo.getObject("topStandaloneBadge") != null || isPremium()) {
|
if (videoInfo.getObject("topStandaloneBadge") != null || isPremium()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
String viewCount = getTextFromObject(videoInfo.getObject("viewCountText"));
|
|
||||||
|
final JsonObject viewCountObject = videoInfo.getObject("viewCountText");
|
||||||
|
if (viewCountObject == null) {
|
||||||
|
// This object is null when a video has its views hidden.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String viewCount = getTextFromObject(viewCountObject);
|
||||||
|
|
||||||
return Long.parseLong(Utils.removeNonDigitCharacters(viewCount));
|
return Long.parseLong(Utils.removeNonDigitCharacters(viewCount));
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return -1;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ParsingException("Could not get view count", e);
|
throw new ParsingException("Could not get view count", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user