Version 1.5.1: FimFiction 4, small fix on eHentai fanfix-1.5.1
authorNiki Roo <niki@nikiroo.be>
Mon, 5 Jun 2017 16:58:59 +0000 (18:58 +0200)
committerNiki Roo <niki@nikiroo.be>
Mon, 5 Jun 2017 16:58:59 +0000 (18:58 +0200)
- Today (10:30 GMT), FimFiction migrated to version 4 and was not compatible any more with Fanfix
- some metadata fixed for eHentai

VERSION
changelog.md
src/be/nikiroo/fanfix/supported/Fimfiction.java

diff --git a/VERSION b/VERSION
index bc80560fad66ca670bdfbd1e5c973a024d4d0325..26ca594609a93d60b6543102d639fa76b50a6925 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.5.0
+1.5.1
index 09b457c4a07f4aa2fa16f9ed9f24e8509d7739ce..54c4bbca3b0d492fe074e9d4ef354b7f26fb5296 100644 (file)
@@ -1,6 +1,7 @@
 # Fanfix
 
-## Version WIP
+## Version 1.5.1
+- Update to FimFiction 4
 - fix some meta data that were missing on e-Hentai
 
 ## Version 1.5.0
index 6293c1147f5530a058d59381bf9fb153aebf660f..1faf615207154501361164721d7be8a2178855a9 100644 (file)
@@ -156,12 +156,12 @@ class Fimfiction extends BasicSupport {
        @Override
        protected String getDesc(URL source, InputStream in) {
                // the og: meta version is the SHORT resume, this is the LONG resume
-               return getLine(in, "class=\"more_button hidden\"", -1);
+               return getLine(in, "class=\"description-text bbcode\"", 1);
        }
 
        private BufferedImage getCover(InputStream in) {
                // Note: the 'og:image' is the SMALL cover, not the full version
-               String cover = getLine(in, "<div class=\"story_image\">", 1);
+               String cover = getLine(in, "class=\"story_container__story_image\"", 1);
                if (cover != null) {
                        int pos = cover.indexOf('"');
                        if (pos >= 0) {
@@ -183,49 +183,58 @@ class Fimfiction extends BasicSupport {
                @SuppressWarnings("resource")
                Scanner scan = new Scanner(in, "UTF-8");
                scan.useDelimiter("\\n");
+               boolean started = false;
                while (scan.hasNext()) {
-                       String line = scan.next();
-                       if (line.contains("class=\"chapter_link\"")
-                                       || line.contains("class='chapter_link'")) {
-                               // Chapter name
-                               String name = line;
-                               int pos = name.indexOf('>');
-                               if (pos >= 0) {
-                                       name = name.substring(pos + 1);
-                                       pos = name.indexOf('<');
+                       String line = scan.next().trim();
+
+                       if (!started) {
+                               started = line.equals("<!--Chapters-->");
+                       } else {
+                               if (line.equals("</form>")) {
+                                       break;
+                               }
+
+                               if (line.startsWith("<a href=")) {
+                                       // Chapter name
+                                       String name = line;
+                                       int pos = name.indexOf('>');
                                        if (pos >= 0) {
-                                               name = name.substring(0, pos);
+                                               name = name.substring(pos + 1);
+                                               pos = name.indexOf('<');
+                                               if (pos >= 0) {
+                                                       name = name.substring(0, pos);
+                                               }
                                        }
-                               }
-                               // Chapter content
-                               pos = line.indexOf('/');
-                               if (pos >= 0) {
-                                       line = line.substring(pos); // we take the /, not +1
-                                       pos = line.indexOf('"');
+                                       // Chapter content
+                                       pos = line.indexOf('/');
                                        if (pos >= 0) {
-                                               line = line.substring(0, pos);
+                                               line = line.substring(pos); // we take the /, not +1
+                                               pos = line.indexOf('"');
+                                               if (pos >= 0) {
+                                                       line = line.substring(0, pos);
+                                               }
                                        }
-                               }
 
-                               try {
-                                       final String key = name;
-                                       final URL value = new URL("http://www.fimfiction.net"
-                                                       + line);
-                                       urls.add(new Entry<String, URL>() {
-                                               public URL setValue(URL value) {
-                                                       return null;
-                                               }
+                                       try {
+                                               final String key = name;
+                                               final URL value = new URL("http://www.fimfiction.net"
+                                                               + line);
+                                               urls.add(new Entry<String, URL>() {
+                                                       public URL setValue(URL value) {
+                                                               return null;
+                                                       }
 
-                                               public String getKey() {
-                                                       return key;
-                                               }
+                                                       public String getKey() {
+                                                               return key;
+                                                       }
 
-                                               public URL getValue() {
-                                                       return value;
-                                               }
-                                       });
-                               } catch (MalformedURLException e) {
-                                       Instance.syserr(e);
+                                                       public URL getValue() {
+                                                               return value;
+                                                       }
+                                               });
+                                       } catch (MalformedURLException e) {
+                                               Instance.syserr(e);
+                                       }
                                }
                        }
                }
@@ -236,7 +245,7 @@ class Fimfiction extends BasicSupport {
        @Override
        protected String getChapterContent(URL source, InputStream in, int number,
                        Progress pg) {
-               return getLine(in, "<div id=\"chapter_container\">", 1);
+               return getLine(in, "<div class=\"bbcode\">", 1);
        }
 
        @Override