Fixed multipart file downloading
This commit is contained in:
parent
4b7bd12313
commit
13dd2694b4
@ -23,6 +23,7 @@ public class LoveromRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
private int bytesTotal = 1;
|
private int bytesTotal = 1;
|
||||||
private int bytesCompleted = 1;
|
private int bytesCompleted = 1;
|
||||||
|
boolean multipart = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
@ -58,6 +59,7 @@ public class LoveromRipper extends AbstractHTMLRipper {
|
|||||||
if (downloadLink != null && !downloadLink.isEmpty()) {
|
if (downloadLink != null && !downloadLink.isEmpty()) {
|
||||||
result.add(downloadLink);
|
result.add(downloadLink);
|
||||||
} else {
|
} else {
|
||||||
|
multipart = true;
|
||||||
for (Element el : doc.select("a.multi-file-btn")) {
|
for (Element el : doc.select("a.multi-file-btn")) {
|
||||||
result.add(el.attr("href"));
|
result.add(el.attr("href"));
|
||||||
}
|
}
|
||||||
@ -72,6 +74,9 @@ public class LoveromRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatusText() {
|
public String getStatusText() {
|
||||||
|
if (multipart) {
|
||||||
|
return super.getStatusText();
|
||||||
|
}
|
||||||
return String.valueOf(getCompletionPercentage()) +
|
return String.valueOf(getCompletionPercentage()) +
|
||||||
"% - " +
|
"% - " +
|
||||||
Utils.bytesToHumanReadable(bytesCompleted) +
|
Utils.bytesToHumanReadable(bytesCompleted) +
|
||||||
@ -81,6 +86,9 @@ public class LoveromRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCompletionPercentage() {
|
public int getCompletionPercentage() {
|
||||||
|
if (multipart) {
|
||||||
|
return super.getCompletionPercentage();
|
||||||
|
}
|
||||||
return (int) (100 * (bytesCompleted / (float) bytesTotal));
|
return (int) (100 * (bytesCompleted / (float) bytesTotal));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user