+ Added interface method in SearchEngine class for fetch search suggestion list.

+ Implemented SearchEngine Interface method in YoutubeSearchEngine class.
This commit is contained in:
chandrashekhar 2015-11-03 13:32:05 +05:30
parent fc32377ce7
commit 68a0eefa20
2 changed files with 21 additions and 0 deletions

View File

@ -32,4 +32,6 @@ public interface SearchEngine {
}
Result search(String query, int page);
Result suggestionList(String query);
}

View File

@ -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;
}
}