From 68a0eefa20712c29fe65407610b3f1c92a72ac3b Mon Sep 17 00:00:00 2001 From: chandrashekhar Date: Tue, 3 Nov 2015 13:32:05 +0530 Subject: [PATCH] + Added interface method in SearchEngine class for fetch search suggestion list. + Implemented SearchEngine Interface method in YoutubeSearchEngine class. --- .../java/org/schabi/newpipe/SearchEngine.java | 2 ++ .../newpipe/youtube/YoutubeSearchEngine.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/SearchEngine.java b/app/src/main/java/org/schabi/newpipe/SearchEngine.java index 5d986f2a4..561988b42 100644 --- a/app/src/main/java/org/schabi/newpipe/SearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/SearchEngine.java @@ -32,4 +32,6 @@ public interface SearchEngine { } Result search(String query, int page); + + Result suggestionList(String query); } diff --git a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java index a59c67295..76f263703 100644 --- a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java @@ -115,4 +115,23 @@ public class YoutubeSearchEngine implements SearchEngine { } return result; } + + @Override + public Result suggestionList(String query) { + +// http://suggestqueries.google.com/complete/search?client=youtube&ds=yt&q=andro + + Uri.Builder builder = new Uri.Builder(); + builder.scheme("https") + .authority("suggestqueries.google.com") + .appendPath("complete") + .appendPath("search") + .appendQueryParameter("client", "youtube") + .appendQueryParameter("ds", "yt") + .appendQueryParameter("q", query); + String url = builder.build().toString(); + + return null; + } + }