use of util.Requestable in project KaellyBot by Kaysoro.
the class DofusRequestCommand method getListRequestableFrom.
protected List<Requestable> getListRequestableFrom(String url, IMessage message, DiscordException notFound) {
List<Requestable> result = new ArrayList<>();
Language lg = Translator.getLanguageFrom(message.getChannel());
try {
Document doc = JSoupManager.getDocument(url);
Elements elems = doc.getElementsByClass("ak-bg-odd");
elems.addAll(doc.getElementsByClass("ak-bg-even"));
for (Element element : elems) result.add(new Requestable(element.child(1).text(), element.child(1).select("a").attr("href")));
} catch (IOException e) {
ExceptionManager.manageIOException(e, message, this, lg, notFound);
return new ArrayList<>();
} catch (Exception e) {
ExceptionManager.manageException(e, message, this, lg);
return new ArrayList<>();
}
return result;
}
Aggregations