- for (Element li : doc.getElementsByTag("li")) {
- Element el = li.getElementsByTag("h4").first();
- if (el == null) {
- el = li.getElementsByTag("h3").first();
- }
- if (el != null) {
- Element a = el.getElementsByTag("a").first();
- if (a != null) {
- String title = StringUtils.unhtml(el.text()).trim();
- try {
- String url = a.absUrl("href");
- if (url.endsWith("1.html")) {
- url = url.substring(0,
- url.length() - "1.html".length());
- }
- if (!url.endsWith("/")) {
- url += "/";
- }
-
- if (prefix == null || !prefix.isEmpty()) {
- StringBuilder possiblePrefix = new StringBuilder(
- StringUtils.unhtml(a.text()).trim());
- while (possiblePrefix.length() > 0) {
- char car = possiblePrefix.charAt(possiblePrefix
- .length() - 1);
- boolean punctuation = (car == '.' || car == ' ');
- boolean digit = (car >= '0' && car <= '9');
- if (!punctuation && !digit) {
- break;
- }
-
- possiblePrefix.setLength(possiblePrefix
- .length() - 1);
- }
-
- if (prefix == null) {
- prefix = possiblePrefix.toString();
- }
-
- if (!prefix.equalsIgnoreCase(possiblePrefix
- .toString())) {
- prefix = ""; // prefix not ok
- }
- }
-
- urls.add(new AbstractMap.SimpleEntry<String, URL>(
- title, new URL(url)));
- } catch (Exception e) {
- Instance.getTraceHandler().error(e);
- }
+ for (Element list : doc.getElementsByClass("detail-main-list")) {
+ for (Element el : list.getElementsByTag("a")) {
+ String title = el.attr("title");
+ if (title.startsWith(prefix)) {
+ title = title.substring(prefix.length()).trim();