From 851028997afa8b5a7b6c62bb7cd74a50bd19a57b Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sun, 21 Feb 2016 21:15:39 +0100 Subject: [PATCH] fixed json error from the last commit --- .../extractor/services/youtube/YoutubeStreamExtractor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 6e7f25a56..39a465393 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -191,13 +191,15 @@ public class YoutubeStreamExtractor implements StreamExtractor { JSONObject ytPlayerConfig; //attempt to load the youtube js player JSON arguments - String ps; //used to determine if this is a livestream or not + String ps = ""; //used to determine if this is a livestream or not try { ytPlayerConfigRaw = Parser.matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", pageContent); ytPlayerConfig = new JSONObject(ytPlayerConfigRaw); playerArgs = ytPlayerConfig.getJSONObject("args"); - ps = playerArgs.get("ps").toString(); + if(playerArgs.has("ps")) { + ps = playerArgs.get("ps").toString(); + } } catch (Parser.RegexException e) { String errorReason = findErrorReason(doc); switch(errorReason) {