mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	made newpipe handle not available like/dislike count
This commit is contained in:
		| @@ -611,8 +611,14 @@ public class YoutubeStreamExtractor extends StreamExtractor { | |||||||
|     public int getLikeCount() throws ParsingException { |     public int getLikeCount() throws ParsingException { | ||||||
|         String likesString = ""; |         String likesString = ""; | ||||||
|         try { |         try { | ||||||
|             likesString = doc.select("button.like-button-renderer-like-button").first() |  | ||||||
|                     .select("span.yt-uix-button-content").first().text(); |             Element button = doc.select("button.like-button-renderer-like-button").first(); | ||||||
|  |             try { | ||||||
|  |                 likesString = button.select("span.yt-uix-button-content").first().text(); | ||||||
|  |             } catch (NullPointerException e) { | ||||||
|  |                 //if this ckicks in our button has no content and thefore likes/dislikes are disabled | ||||||
|  |                 return -1; | ||||||
|  |             } | ||||||
|             return Integer.parseInt(likesString.replaceAll("[^\\d]", "")); |             return Integer.parseInt(likesString.replaceAll("[^\\d]", "")); | ||||||
|         } catch (NumberFormatException nfe) { |         } catch (NumberFormatException nfe) { | ||||||
|             throw new ParsingException( |             throw new ParsingException( | ||||||
| @@ -626,8 +632,13 @@ public class YoutubeStreamExtractor extends StreamExtractor { | |||||||
|     public int getDislikeCount() throws ParsingException { |     public int getDislikeCount() throws ParsingException { | ||||||
|         String dislikesString = ""; |         String dislikesString = ""; | ||||||
|         try { |         try { | ||||||
|             dislikesString = doc.select("button.like-button-renderer-dislike-button").first() |             Element button = doc.select("button.like-button-renderer-dislike-button").first(); | ||||||
|                     .select("span.yt-uix-button-content").first().text(); |             try { | ||||||
|  |                 dislikesString = button.select("span.yt-uix-button-content").first().text(); | ||||||
|  |             } catch (NullPointerException e) { | ||||||
|  |                 //if this kicks in our button has no content and therefore likes/dislikes are disabled | ||||||
|  |                 return -1; | ||||||
|  |             } | ||||||
|             return Integer.parseInt(dislikesString.replaceAll("[^\\d]", "")); |             return Integer.parseInt(dislikesString.replaceAll("[^\\d]", "")); | ||||||
|         } catch(NumberFormatException nfe) { |         } catch(NumberFormatException nfe) { | ||||||
|             throw new ParsingException( |             throw new ParsingException( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Christian Schabesberger
					Christian Schabesberger