Version 1.5.2: fix Fimfiction 4 metadata fanfix-1.5.2
authorNiki Roo <niki@nikiroo.be>
Mon, 5 Jun 2017 17:21:25 +0000 (19:21 +0200)
committerNiki Roo <niki@nikiroo.be>
Mon, 5 Jun 2017 17:21:25 +0000 (19:21 +0200)
VERSION
changelog.md
src/be/nikiroo/fanfix/supported/Fimfiction.java

diff --git a/VERSION b/VERSION
index 26ca594609a93d60b6543102d639fa76b50a6925..4cda8f19edc7ffa01ba13d5dbe4909a6dc2ce3c8 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.5.1
+1.5.2
index 54c4bbca3b0d492fe074e9d4ef354b7f26fb5296..8c7e65873e50d814f47c5ec9edd2c54f43c7f296 100644 (file)
@@ -1,8 +1,11 @@
 # Fanfix
 
+## Version 1.5.2
+- Fix tags metadata on FimFiction 4
+
 ## Version 1.5.1
 - Update to FimFiction 4
-- fix some meta data that were missing on e-Hentai
+- Fix some meta data that were missing on e-Hentai
 
 ## Version 1.5.0
 - New website supported following a request: e-hentai.org
index 1faf615207154501361164721d7be8a2178855a9..45455b610f2a05193746e4e8bffcf0163d10e55a 100644 (file)
@@ -70,21 +70,25 @@ 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("story_category") && !line.contains("title=")) {
-                               int pos = line.indexOf('>');
-                               if (pos >= 0) {
-                                       line = line.substring(pos + 1);
-                                       pos = line.indexOf('<');
-                                       if (pos >= 0) {
-                                               line = line.substring(0, pos);
-                                       }
+
+                       if (!started) {
+                               started = line.contains("\"story_container\"");
+                       }
+
+                       if (started && line.contains("class=\"tag-")) {
+                               if (line.contains("index.php")) {
+                                       break; // end of *this story* tags
                                }
 
-                               line = line.trim();
-                               if (!tags.contains(line)) {
-                                       tags.add(line);
+                               String tab[] = line.split("<li>");
+                               for (String subline : tab) {
+                                       subline = StringUtils.unhtml(subline).trim();
+                                       if (!subline.isEmpty() && !tags.contains(subline)) {
+                                               tags.add(subline);
+                                       }
                                }
                        }
                }