From 145a7f8e0df5a0d6d235f6fd1d19dea3e5aea3d3 Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 12 Nov 2015 12:18:41 +0300 Subject: [PATCH] fix bug with parsing like/dislike count --- .../java/org/schabi/newpipe/youtube/YoutubeExtractor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java index fe49cd97c..6d23ae038 100644 --- a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java @@ -287,12 +287,12 @@ public class YoutubeExtractor implements Extractor { // likes likesString = doc.select("button.like-button-renderer-like-button").first() .select("span.yt-uix-button-content").first().text(); - videoInfo.like_count = Integer.parseInt(likesString.replace(",", "")); + videoInfo.like_count = Integer.parseInt(likesString.replaceAll("[^\\d]", "")); // dislikes dislikesString = doc.select("button.like-button-renderer-dislike-button").first() .select("span.yt-uix-button-content").first().text(); - videoInfo.dislike_count = Integer.parseInt(dislikesString.replace(",", "")); + videoInfo.dislike_count = Integer.parseInt(dislikesString.replaceAll("[^\\d]", "")); } catch(NumberFormatException nfe) { Log.e(TAG, "failed to parse likesString \""+likesString+"\" and dislikesString \""+ dislikesString+"\" as integers");