Merge pull request #126 from Adam77Root/master

Fix view count parsing for large numbers
This commit is contained in:
Christian Schabesberger 2015-12-25 16:02:10 +01:00
commit 86a0177855
2 changed files with 3 additions and 3 deletions

View file

@ -109,7 +109,7 @@ public abstract class VideoExtractor {
protected abstract String getDescription(); protected abstract String getDescription();
protected abstract String getUploader(); protected abstract String getUploader();
protected abstract int getLength(); protected abstract int getLength();
protected abstract int getViews(); protected abstract long getViews();
protected abstract String getUploadDate(); protected abstract String getUploadDate();
protected abstract String getThumbnailUrl(); protected abstract String getThumbnailUrl();
protected abstract String getUploaderThumbnailUrl(); protected abstract String getUploaderThumbnailUrl();

View file

@ -155,10 +155,10 @@ public class YoutubeVideoExtractor extends VideoExtractor {
} }
@Override @Override
public int getViews() { public long getViews() {
try { try {
String viewCountString = doc.select("meta[itemprop=interactionCount]").attr("content"); String viewCountString = doc.select("meta[itemprop=interactionCount]").attr("content");
return Integer.parseInt(viewCountString); return Long.parseLong(viewCountString);
} catch (Exception e) {//todo: find fallback method } catch (Exception e) {//todo: find fallback method
Log.e(TAG, "failed to number of views"); Log.e(TAG, "failed to number of views");
e.printStackTrace(); e.printStackTrace();