Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
grandiloquent committed Sep 27, 2021
1 parent a8e7f1a commit 3bba681
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ android {
}

dependencies {
implementation 'org.brotli:dec:0.1.1'
implementation 'com.tencent.bugly:crashreport:latest.release'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation('com.github.evgenyneu:js-evaluator-for-android:v4.0.0') {
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/euphoria/psycho/share/NetShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.content.Context;
import android.net.ConnectivityManager;

import org.brotli.dec.BrotliInputStream;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -83,7 +85,9 @@ public static String readString(HttpURLConnection connection) {
else if (contentEncoding != null && contentEncoding.equals("br")) {
in = new BrotliInputStream(connection.getInputStream());
} */
else {
if (contentEncoding != null && contentEncoding.equals("br")) {
in = new BrotliInputStream(connection.getInputStream());
} else {
in = connection.getInputStream();
}
reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
Expand Down Expand Up @@ -124,7 +128,7 @@ public static boolean isInternetAvailable() {
return false;
}

public static void disableSSLCertificateChecking() {
public static void disableSSLCertificateChecking() {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
Expand Down
42 changes: 39 additions & 3 deletions app/src/main/java/euphoria/psycho/videos/VideosHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,27 @@ public static String extract91PornVideoAddress(String uri) {
try {
headers = getLocationAddCookie(
"https://91porn.com/index.php",
null
new String[][]{
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"},
{"Accept-Encoding", "gzip, deflate, br"},
{"Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8"},
{"Cache-Control", "no-cache"},
{"Connection", "keep-alive"},
{"Host", "91porn.com"},
{"Pragma", "no-cache"},
{"sec-ch-ua", "\"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\""},
{"sec-ch-ua-mobile", "?0"},
{"sec-ch-ua-platform", "\"Windows\""},
{"Sec-Fetch-Dest", "document"},
{"Sec-Fetch-Mode", "navigate"},
{"Sec-Fetch-Site", "none"},
{"Sec-Fetch-User", "?1"},
{"Upgrade-Insecure-Requests", "1"},
{"User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36"}}
);
Log.e("B5aOx2", String.format("extract91PornVideoAddress, %s", headers[1]));
} catch (IOException e) {
Log.e("B5aOx2", String.format("extract91PornVideoAddress, %s", e.getMessage()));
e.printStackTrace();
}
if (headers == null) {
Expand All @@ -59,10 +77,26 @@ public static String extract91PornVideoAddress(String uri) {
// get around the 50 views per day
// for non members limitation
String response = getString(uri, new String[][]{
{"Referer", "https://91porn.com"},
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"},
{"Accept-Encoding", "gzip, deflate, br"},
{"Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8"},
{"Cache-Control", "no-cache"},
{"Connection", "keep-alive"},
{"Host", "91porn.com"},
{"Pragma", "no-cache"},
{"sec-ch-ua", "\"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\""},
{"sec-ch-ua-mobile", "?0"},
{"sec-ch-ua-platform", "\"Windows\""},
{"Sec-Fetch-Dest", "document"},
{"Sec-Fetch-Mode", "navigate"},
{"Sec-Fetch-Site", "none"},
{"Sec-Fetch-User", "?1"},
{"Upgrade-Insecure-Requests", "1"},
{"User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36"},
{"X-Forwarded-For", NetShare.randomIp()},
{"Cookie", headers[1]}
});
Log.e("B5aOx2", String.format("extract91PornVideoAddress, %s", response));
if (response == null) {
// byte[] buffer = new byte[128];
// byte[] buf = uri.getBytes(StandardCharsets.UTF_8);
Expand Down Expand Up @@ -118,12 +152,12 @@ public static String getLocation(String uri, String[][] headers) throws IOExcept
public static String[] getLocationAddCookie(String uri, String[][] headers) throws IOException {
URL url = new URL(uri);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
//urlConnection.setRequestProperty("User-Agent", USER_AGENT);
if (headers != null) {
for (String[] header : headers) {
urlConnection.setRequestProperty(header[0], header[1]);
}
}
urlConnection.setRequestProperty("User-Agent", USER_AGENT);
urlConnection.setInstanceFollowRedirects(false);
Map<String, List<String>> listMap = urlConnection.getHeaderFields();
StringBuilder stringBuilder = new StringBuilder();
Expand All @@ -135,6 +169,7 @@ public static String[] getLocationAddCookie(String uri, String[][] headers) thro
}
}
}
Log.e("B5aOx2", String.format("getLocationAddCookie, %s", urlConnection.getResponseCode()));
return new String[]{urlConnection.getHeaderField("Location"), stringBuilder.toString()};
}

Expand Down Expand Up @@ -179,6 +214,7 @@ public static String getString(String uri, String[][] headers) {
urlConnection.setRequestProperty(header[0], header[1]);
}
}
//NetShare.iterateResponseHeader(urlConnection);
int code = urlConnection.getResponseCode();
if (code < 400 && code >= 200) {
return NetShare.readString(urlConnection);
Expand Down

0 comments on commit 3bba681

Please sign in to comment.