e621: searches: add cover (first image)
authorNiki Roo <niki@nikiroo.be>
Fri, 10 Aug 2018 13:52:21 +0000 (15:52 +0200)
committerNiki Roo <niki@nikiroo.be>
Fri, 10 Aug 2018 13:52:21 +0000 (15:52 +0200)
src/be/nikiroo/fanfix/supported/E621.java

index 44621b9a79fe31ea10773dd6ca3d88b158a092e6..407ec70ee996123e2b759e2169802fb86cfec63a 100644 (file)
@@ -130,12 +130,12 @@ class E621 extends BasicSupport_Deprecated {
        }
 
        private Image getCover(URL source, InputStream in) throws IOException {
-               // No cover on searches (/post/)
-               if (isSearch(source))
-                       return null;
+               URL urlForCover = source;
+               if (isPool(source)) {
+                       urlForCover = new URL(source.toString() + "?page=1");
+               }
 
-               String images = getChapterContent(new URL(source.toString() + "?page="
-                               + 1), in, 1, null);
+               String images = getChapterContent(urlForCover, in, 1, null);
                if (!images.isEmpty()) {
                        int pos = images.indexOf("<br/>");
                        if (pos >= 0) {