Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
testing and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
FultonBrowne committed Oct 11, 2019
1 parent 6868c07 commit 5b4f2a3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/com/andromeda/araserver/skills/GetInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public String main(String mainurl) {
ArrayList<String> pairs = new ArrayList<>(Arrays.asList(mainurl.split("&")));
term = pairs.get(0);
System.out.println(term);
try {
getFast("ten times ten");
} catch (IOException e) {
e.printStackTrace();
}
outputModels.add(new OutputModel("test", mainurl, "https://github.com/FultonBrowne/Ara-Server", "", "", ""));
try {
outputModels.addAll(searchBing(term));
Expand All @@ -55,16 +60,15 @@ private ArrayList<OutputModel> searchBing(String searchQuery) throws IOException
JsonObject jsonObject = jelement.getAsJsonObject();
jsonObject = jsonObject.getAsJsonObject("webPages");
JsonArray jsonArray = jsonObject.getAsJsonArray("value");
System.out.println(jsonArray.size());
getFast("two times two");
for (int i = 0; i < jsonArray.size(); i++) {
System.out.println(jsonArray.get(i).isJsonObject());
//System.out.println(jsonArray.get(i).isJsonObject());
String title = jsonArray.get(i).getAsJsonObject().get("name").getAsString();
System.out.println(title);
//System.out.println(title);
String info = jsonArray.get(i).getAsJsonObject().get("snippet").getAsString();
System.out.println(info);
String link = jsonArray.get(i).getAsJsonObject().get("url").getAsString();
System.out.println(link);
//System.out.println(link);
mainList.add(new OutputModel(title, info, link, "", "", ""));


Expand All @@ -86,7 +90,7 @@ private void getFast(String searchQuery) throws IOException {
String response = new Scanner(stream).useDelimiter("\\A").next();
JsonElement jelement = new JsonParser().parse(response);
JsonObject jsonObject = jelement.getAsJsonObject();
jsonObject = jsonObject.getAsJsonObject("expression");
jsonObject = jsonObject.getAsJsonObject("Computation");
System.out.println(jsonObject);
//JsonArray jsonArray = jsonObject.getAsJsonArray("value");

Expand Down

0 comments on commit 5b4f2a3

Please sign in to comment.