- Element chapEls = doc.getElementsByClass("chapters").first();
- for (Element chapEl : chapEls.getElementsByTag("li")) {
- Element titleEl = chapEl.getElementsByTag("h5").first();
- String title = StringUtils.unhtml(titleEl.text()).trim();
- title = Integer.toString(i++); // because Atril does not support
- // strange file names
-
- Element linkEl = chapEl.getElementsByTag("h5").first()
- .getElementsByTag("a").first();
- String link = linkEl.absUrl("href");
-
- try {
- urls.add(new AbstractMap.SimpleEntry<String, URL>(title,
- new URL(link)));
- } catch (MalformedURLException e) {
- Instance.getTraceHandler().error(e);
+ Element table = doc.getElementsByClass("table").first();
+ if (table != null) {
+ for (Element tr : table.getElementsByTag("tr")) {
+ Element a = tr.getElementsByTag("a").first();
+ if (a != null) {
+ String name = StringUtils.unhtml(a.text()).trim();
+ URL url = new URL(a.absUrl("href"));
+ urls.add(new AbstractMap.SimpleEntry<String, URL>(name, url));
+ }