From 13dd2694b45ec21ead0f2ed2e7a1878645a44cf3 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Mon, 9 Jul 2018 11:19:15 -0400 Subject: [PATCH] Fixed multipart file downloading --- .../com/rarchives/ripme/ripper/rippers/LoveromRipper.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/LoveromRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/LoveromRipper.java index 88c9c0f5..bddecf64 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/LoveromRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/LoveromRipper.java @@ -23,6 +23,7 @@ public class LoveromRipper extends AbstractHTMLRipper { private int bytesTotal = 1; private int bytesCompleted = 1; + boolean multipart = false; @Override public String getHost() { @@ -58,6 +59,7 @@ public class LoveromRipper extends AbstractHTMLRipper { if (downloadLink != null && !downloadLink.isEmpty()) { result.add(downloadLink); } else { + multipart = true; for (Element el : doc.select("a.multi-file-btn")) { result.add(el.attr("href")); } @@ -72,6 +74,9 @@ public class LoveromRipper extends AbstractHTMLRipper { @Override public String getStatusText() { + if (multipart) { + return super.getStatusText(); + } return String.valueOf(getCompletionPercentage()) + "% - " + Utils.bytesToHumanReadable(bytesCompleted) + @@ -81,6 +86,9 @@ public class LoveromRipper extends AbstractHTMLRipper { @Override public int getCompletionPercentage() { + if (multipart) { + return super.getCompletionPercentage(); + } return (int) (100 * (bytesCompleted / (float) bytesTotal)); }