-
- if (started && line.contains(linkAt)) {
- // Chapter content url
- String url = null;
- int pos = line.indexOf("href=\"");
- if (pos >= 0) {
- line = line.substring(pos + "href=\"".length());
- pos = line.indexOf('\"');
- if (pos >= 0) {
- url = line.substring(0, pos);
- }
- }
-
- // Chapter name
- String name = null;
- if (scan.hasNext()) {
- name = StringUtils.unhtml(scan.next()).trim();
- // Remove the "new" tag if present
- if (name.endsWith("new")) {
- name = name.substring(0, name.length() - 3).trim();
- }
- }
-
- // to help with the retry and the originalUrl
- refresh(url);
-
- try {
- final String key = name;
- final URL value = new URL(url);
- urls.add(new Entry<String, URL>() {
- public URL setValue(URL value) {
- return null;
+ 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());