- @Override
- protected String getAuthor(URL source, InputStream in) throws IOException {
- String author = getLine(in, "href=\"/post/show/", 0);
- if (author != null) {
- String key = "href=\"";
- int pos = author.indexOf(key);
- if (pos >= 0) {
- author = author.substring(pos + key.length());
- pos = author.indexOf("\"");
- if (pos >= 0) {
- author = author.substring(0, pos - 1);
- String page = source.getProtocol() + "://"
- + source.getHost() + author;
- InputStream pageIn = Instance.getCache().open(
- new URL(page), this, false);
- try {
- key = "class=\"tag-type-artist\"";
- author = getLine(pageIn, key, 0);
- if (author != null) {
- pos = author.indexOf("<a href=\"");
- if (pos >= 0) {
- author = author.substring(pos);
- pos = author.indexOf("</a>");
- if (pos >= 0) {
- author = author.substring(0, pos);
- return StringUtils.unhtml(author);
- }
- }
- }
- } finally {
- pageIn.close();
+ if (source.getHost().contains("e926")) {
+ baseUrl = baseUrl.replace("e621", "e926");
+ }
+
+ for (int i = 1; true; i++) {
+ URL url = new URL(baseUrl + i + parameters);
+ try {
+ InputStream pageI = Instance.getInstance().getCache().open(url, this, false);
+ try {
+ if (IOUtils.readSmallStream(pageI).contains("Nobody here but us chickens!")) {
+ break;