pull/199/head
FongMi 2 years ago
parent b22a759c10
commit 8378d782ef
  1. 2
      app/src/main/java/com/fongmi/android/tv/player/ParseJob.java
  2. 8
      app/src/main/java/com/fongmi/android/tv/ui/custom/CustomWebView.java

@ -177,7 +177,7 @@ public class ParseJob implements ParseCallback {
}
private void startWeb(String key, String from, Map<String, String> headers, String url) {
App.post(() -> webViews.add(CustomWebView.create(App.get()).start(key, from, headers, url, this, true)));
App.post(() -> webViews.add(CustomWebView.create(App.get()).start(key, from, headers, url, this, !url.contains("player/?url="))));
}
private Map<String, String> getHeader(JsonObject object) {

@ -37,8 +37,8 @@ public class CustomWebView extends WebView {
private ParseCallback callback;
private AlertDialog dialog;
private Runnable timer;
private boolean detect;
private String from;
private boolean sub;
private String key;
public static CustomWebView create(@NonNull Context context) {
@ -73,14 +73,14 @@ public class CustomWebView extends WebView {
}
}
public CustomWebView start(String key, String from, Map<String, String> headers, String url, ParseCallback callback, boolean sub) {
public CustomWebView start(String key, String from, Map<String, String> headers, String url, ParseCallback callback, boolean detect) {
App.post(timer, Constant.TIMEOUT_PARSE_WEB);
this.callback = callback;
setUserAgent(headers);
loadUrl(url, headers);
this.detect = detect;
this.from = from;
this.key = key;
this.sub = sub;
return this;
}
@ -93,7 +93,7 @@ public class CustomWebView extends WebView {
Map<String, String> headers = request.getRequestHeaders();
if (TextUtils.isEmpty(host) || ApiConfig.get().getAds().contains(host)) return empty;
if (url.contains("challenges.cloudflare.com/cdn-cgi")) App.post(() -> showDialog());
if (sub && url.contains("player/?url=")) onParseAdd(headers, url);
if (detect && url.contains("player/?url=")) onParseAdd(headers, url);
else if (isVideoFormat(headers, url)) interrupt(headers, url);
return super.shouldInterceptRequest(view, request);
}

Loading…
Cancel
Save