Skip to content

Commit

Permalink
修复档案下载在捐赠用户浏览站点为里站时不起作用的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojieonly committed Apr 7, 2024
1 parent 8cd99e7 commit 5f331d1
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import androidx.annotation.Nullable;

import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.hippo.ehviewer.AppConfig;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
Expand Down Expand Up @@ -331,6 +332,7 @@ private static boolean save(OkHttpClient client, String url, File file) {
return true;
} catch (Throwable t) {
ExceptionUtils.throwIfFatal(t);
FirebaseCrashlytics.getInstance().recordException(t);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

import android.util.Pair;

import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.data.ArchiverData;
import com.hippo.network.UrlBuilder;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
Expand Down Expand Up @@ -57,22 +60,40 @@ public static Pair<String, Pair<String, String>[]> parse(String body) {
public static ArchiverData parseArchiver(String body) {
ArchiverData data = new ArchiverData();
Document document = Jsoup.parse(body);
if (Settings.getGallerySite()== EhUrl.SITE_E){
try {
Element bodyElement = (Element) document.childNode(2).childNode(3).childNode(1);
data.funds = bodyElement.child(2).text();

try {
Element bodyElement = (Element) document.childNode(2).childNode(3).childNode(1);
data.funds = bodyElement.child(2).text();
Element original = bodyElement.child(3).child(0);
data.originalCost = original.child(0).child(0).text();
data.originalSize = original.child(2).child(0).text();
data.originalUrl = original.child(1).attr("action");

Element original = bodyElement.child(3).child(0);
data.originalCost = original.child(0).child(0).text();
data.originalSize = original.child(2).child(0).text();
data.originalUrl = original.child(1).attr("action");
Element resample = bodyElement.child(3).child(1);
data.resampleCost = resample.child(0).child(0).text();
data.resampleSize = resample.child(2).child(0).text();
data.resampleUrl = resample.child(1).attr("action");
} catch (Exception ignore) {
}
}else {
try {
Element bodyElement = (Element) document.childNode(2).childNode(3).childNode(1);
data.funds = bodyElement.child(0).text();

Element resample = bodyElement.child(3).child(1);
data.resampleCost = resample.child(0).child(0).text();
data.resampleSize = resample.child(2).child(0).text();
data.resampleUrl = resample.child(1).attr("action");
} catch (Exception ignore) {
Element original = bodyElement.child(1).child(0);
data.originalCost = original.child(0).child(0).text();
data.originalSize = original.child(2).child(0).text();
data.originalUrl = original.child(1).attr("action");

Element resample = bodyElement.child(1).child(1);
data.resampleCost = resample.child(0).child(0).text();
data.resampleSize = resample.child(2).child(0).text();
data.resampleUrl = resample.child(1).attr("action");
} catch (Exception ignore) {
}
}

return data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import com.hippo.ehviewer.AppConfig;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.client.EhClient;
import com.hippo.ehviewer.client.EhRequest;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.data.ArchiverData;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.ehviewer.client.exception.NoHAtHClientException;
Expand Down Expand Up @@ -144,7 +146,13 @@ public void onDismiss(DialogInterface dialog) {
@Override
public void onSuccess(ArchiverData result) {
data = result;
String cF = context.getString(R.string.archiver_dialog_current_funds) + data.funds;
String cF;
if (Settings.getGallerySite()== EhUrl.SITE_E){
cF = context.getString(R.string.archiver_dialog_current_funds) + data.funds;
}else {
cF = data.funds;
}

currentFunds.setText(cF);
String oC = context.getString(R.string.archiver_dialog_cost, data.originalCost);
String rC = context.getString(R.string.archiver_dialog_cost, data.resampleCost);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Archiver</title>
<link rel="stylesheet" type="text/css" href="https://exhentai.org/z/0372/x.css"/>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex,nofollow"/>
<link rel="icon" type="image/png" href="/favicon.png"/>
<style type="text/css">
div#db{width:450px;text-align:center;margin:5px auto auto auto;border:1px solid #000000;background:#4f535b;padding:2px 5px 2px 5px}

</style>
</head>
<body>
<div id="db">
<h1 style="font-size:10pt; font-weight:bold">COSPLAYTALE NAKO MASHMAID</h1>


<div style="position:relative; width:370px; margin:4px auto 4px; padding-top:3px">
<div style="width:180px; float:left">
<div style="text-align:center; margin-top:4px">Download Cost: &nbsp;
<strong>Free!</strong></div>

<form action="https://exhentai.org/archiver.php?gid=2881867&amp;token=b5727f74ec&amp;or=475687-4d0aae5d32a448278ccdf0e8ac7bd32578e76479"
method="post">
<input type="hidden" name="dltype" value="org"/>
<div style="margin:3px auto"><input type="submit" name="dlcheck"
value="Download Original Archive"
style="width:180px"/></div>
</form>

<p>Estimated Size: &nbsp; <strong>18.46 MiB</strong></p>
</div>

<div style="width:180px; float:right">
<div style="text-align:center; margin-top:4px">Download Cost: &nbsp;
<strong>Free!</strong></div>

<form action="https://exhentai.org/archiver.php?gid=2881867&amp;token=b5727f74ec&amp;or=475687-4d0aae5d32a448278ccdf0e8ac7bd32578e76479"
method="post">
<input type="hidden" name="dltype" value="res"/>
<div style="margin:3px auto"><input type="submit" name="dlcheck"
value="Download Resample Archive"
style="width:180px"/></div>
</form>

<p>Estimated Size: &nbsp; <strong>2.17 MiB</strong></p>
</div>

<div style="clear:both"></div>
</div>

<div style="position:relative; margin:4px auto 4px; padding-top:3px">
<p style="font-weight:bold">H@H Downloader</p>
<form id="hathdl_form"
action="https://exhentai.org/archiver.php?gid=2881867&amp;token=b5727f74ec&amp;or=475687-4d0aae5d32a448278ccdf0e8ac7bd32578e76479"
method="post"><input type="hidden" id="hathdl_xres" name="hathdl_xres" value=""/>
</form>
<table style="margin:auto">
<tr>
<td style="font-weight:bold; width:70px; height:62px; border-right:1px dotted #000000; border-left:1px dotted #000000">
<p><a href="#" onclick="return do_hathdl('780')">780x</a></p>
<p>588.4 KiB</p>
<p>Free</p>
</td>
<td style="font-weight:bold; width:70px; height:62px; border-right:1px dotted #000000">
<p><a href="#" onclick="return do_hathdl('980')">980x</a></p>
<p>2.21 MiB</p>
<p>Free</p>
</td>
<td style="font-weight:bold; width:70px; height:62px; border-right:1px dotted #000000">
<p><a href="#" onclick="return do_hathdl('1280')">1280x</a></p>
<p>2.17 MiB</p>
<p>Free</p>
</td>
<td style="font-weight:bold; width:70px; height:62px; border-right:1px dotted #000000">
<p><a href="#" onclick="return do_hathdl('1600')">1600x</a></p>
<p>5.89 MiB</p>
<p>Free</p>
</td>
<td style="font-weight:bold; width:70px; height:62px; border-right:1px dotted #000000">
<p><a href="#" onclick="return do_hathdl('2400')">2400x</a></p>
<p>11.00 MiB</p>
<p>Free</p>
</td>
<td style="font-weight:bold; width:70px; height:62px; border-right:1px dotted #000000">
<p><a href="#" onclick="return do_hathdl('org')">Original</a></p>
<p>18.46 MiB</p>
<p>Free</p>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function do_hathdl(xres) {
document.getElementById("hathdl_xres").value = xres;
document.getElementById("hathdl_form").submit();
return false;
}

</script>
</div>
</body>
</html>

0 comments on commit 5f331d1

Please sign in to comment.