- private String getTitle(InputStream in) throws IOException {
- String title = getLine(in, "<title>", 0);
- if (title != null) {
- int pos = title.indexOf('>');
- if (pos >= 0) {
- title = title.substring(pos + 1);
- pos = title.indexOf('<');
- if (pos >= 0) {
- title = title.substring(0, pos);
+ @Override
+ protected String getChapterContent(URL chapUrl, int number, Progress pg) throws IOException {
+ StringBuilder builder = new StringBuilder();
+ Document chapterNode = loadDocument(chapUrl);
+
+ Elements articles = chapterNode.getElementsByTag("article");
+
+ // sets and some pools are sorted in reverse order on the website
+ if (getSource().getPath().startsWith("/posts")) {
+ Collections.reverse(articles);
+ }
+
+ for (Element el : articles) {
+ builder.append("[");
+ builder.append(el.attr("data-file-url"));
+ builder.append("]<br/>");
+ }
+
+ return builder.toString();
+ }
+
+ @Override
+ protected URL getCanonicalUrl(URL source) {
+ // Convert search-pools into proper pools
+ if (source.getPath().equals("/posts") && source.getQuery() != null
+ && source.getQuery().startsWith("tags=pool%3A")) {
+ String poolNumber = source.getQuery()
+ .substring("tags=pool%3A".length());
+ try {
+ Integer.parseInt(poolNumber);
+ String base = source.getProtocol() + "://" + source.getHost();
+ if (source.getPort() != -1) {
+ base = base + ":" + source.getPort();