From f63b35e2c0545ba0109497152c56c32e7e95c20f Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sat, 5 Mar 2016 17:35:57 +0100 Subject: [PATCH] fixed search error --- .../extractor/services/youtube/YoutubeSearchEngine.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java index 5cbbdfb90..7dedef6ee 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java @@ -16,6 +16,7 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import java.net.URLEncoder; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; @@ -69,7 +70,7 @@ public class YoutubeSearchEngine extends SearchEngine { */ String url = "https://www.youtube.com/results" - + "?search_query=" + query + + "?search_query=" + URLEncoder.encode(query, "UTF-8") + "&page=" + Integer.toString(page) + "&filters=" + "video"; @@ -148,8 +149,8 @@ public class YoutubeSearchEngine extends SearchEngine { + "?client=" + "" + "&output=" + "toolbar" + "&ds=" + "yt" - + "&hl=" + contentCountry - + "&q=" + query; + + "&hl=" + URLEncoder.encode(contentCountry, "UTF-8") + + "&q=" + URLEncoder.encode(query, "UTF-8"); String response = dl.download(url);