From 718d4fd0bdaf5bc35f404a37f7dabca522d06246 Mon Sep 17 00:00:00 2001 From: Adam77Root Date: Fri, 25 Dec 2015 15:03:11 +0100 Subject: [PATCH] Fix view count parsing for large numbers --- .../main/java/org/schabi/newpipe/services/VideoExtractor.java | 2 +- .../newpipe/services/youtube/YoutubeVideoExtractor.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java b/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java index dfe2e161f..ff2b736d4 100644 --- a/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java @@ -109,7 +109,7 @@ public abstract class VideoExtractor { protected abstract String getDescription(); protected abstract String getUploader(); protected abstract int getLength(); - protected abstract int getViews(); + protected abstract long getViews(); protected abstract String getUploadDate(); protected abstract String getThumbnailUrl(); protected abstract String getUploaderThumbnailUrl(); diff --git a/app/src/main/java/org/schabi/newpipe/services/youtube/YoutubeVideoExtractor.java b/app/src/main/java/org/schabi/newpipe/services/youtube/YoutubeVideoExtractor.java index 94a1cb151..bb8338909 100644 --- a/app/src/main/java/org/schabi/newpipe/services/youtube/YoutubeVideoExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/services/youtube/YoutubeVideoExtractor.java @@ -155,10 +155,10 @@ public class YoutubeVideoExtractor extends VideoExtractor { } @Override - public int getViews() { + public long getViews() { try { String viewCountString = doc.select("meta[itemprop=interactionCount]").attr("content"); - return Integer.parseInt(viewCountString); + return Long.parseLong(viewCountString); } catch (Exception e) {//todo: find fallback method Log.e(TAG, "failed to number of views"); e.printStackTrace();