From c3c7900359a459fabfe59e8af212921036f5f5ed Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Mon, 5 Jun 2017 19:21:25 +0200 Subject: [PATCH] Version 1.5.2: fix Fimfiction 4 metadata --- VERSION | 2 +- changelog.md | 5 +++- .../nikiroo/fanfix/supported/Fimfiction.java | 26 +++++++++++-------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index 26ca594..4cda8f1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.1 +1.5.2 diff --git a/changelog.md b/changelog.md index 54c4bbc..8c7e658 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/src/be/nikiroo/fanfix/supported/Fimfiction.java b/src/be/nikiroo/fanfix/supported/Fimfiction.java index 1faf615..45455b6 100644 --- a/src/be/nikiroo/fanfix/supported/Fimfiction.java +++ b/src/be/nikiroo/fanfix/supported/Fimfiction.java @@ -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("
  • "); + for (String subline : tab) { + subline = StringUtils.unhtml(subline).trim(); + if (!subline.isEmpty() && !tags.contains(subline)) { + tags.add(subline); + } } } } -- 2.27.0