- String res = Jsoup.connect("https://mywaifulist.moe/api/waifu/search")
+ String res = Jsoup.connect("https://mywaifulist.moe/api/waifu/advancedsearch") //has problems with short names - names are sorted by ascending and only first 25 returns, so my own sorting cant work well with many pages of results
+ .sorted((a, b) -> wholeWord.matcher(a.getString("name")).matches() && !wholeWord.matcher(b.getString("name")).matches() ? -1 : 0) //move whole word matches up only if last one was not matched
+ .collect(Collectors.toList());
+
+ //fetch
main = new JSONObject(new JSONTokener(Jsoup.connect("https://mywaifulist.moe/api/waifu/" + arr.get(index).getInt("id"))
+ + (!jobj.isNull("description") ? (" \"" + jobj.getString("description").substring(0, Math.min(jobj.getString("description").length(), avg)).replaceAll("\"", "”")) //trim desc to max length, replacing double quotes since it will interfere with markdown
+ + (jobj.getString("description").length() > avg ? "..." : "") + "\")" : ")")) //append ... if its not finished (only if desc is non null will desc be printed)