|
|
|
|
@ -14,6 +14,7 @@ import com.tencent.smtt.export.external.interfaces.SslError; |
|
|
|
|
import com.tencent.smtt.export.external.interfaces.SslErrorHandler; |
|
|
|
|
import com.tencent.smtt.export.external.interfaces.WebResourceRequest; |
|
|
|
|
import com.tencent.smtt.export.external.interfaces.WebResourceResponse; |
|
|
|
|
import com.tencent.smtt.sdk.CookieManager; |
|
|
|
|
import com.tencent.smtt.sdk.QbSdk; |
|
|
|
|
import com.tencent.smtt.sdk.WebChromeClient; |
|
|
|
|
import com.tencent.smtt.sdk.WebView; |
|
|
|
|
@ -31,7 +32,6 @@ import com.fongmi.android.tv.impl.ParseCallback; |
|
|
|
|
import com.fongmi.android.tv.ui.dialog.WebDialog; |
|
|
|
|
import com.fongmi.android.tv.utils.Sniffer; |
|
|
|
|
import com.github.catvod.crawler.Spider; |
|
|
|
|
import com.github.catvod.net.OkCookieJar; |
|
|
|
|
import com.google.common.net.HttpHeaders; |
|
|
|
|
import com.orhanobut.logger.Logger; |
|
|
|
|
|
|
|
|
|
@ -108,14 +108,13 @@ public class CustomWebView extends WebView implements DialogInterface.OnDismissL |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void start(String url, Map<String, String> headers) { |
|
|
|
|
OkCookieJar.setAcceptThirdPartyCookies(this); |
|
|
|
|
CookieManager.getInstance().setAcceptThirdPartyCookies(this, true); |
|
|
|
|
checkHeader(url, headers); |
|
|
|
|
loadUrl(url, headers); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkHeader(String url, Map<String, String> headers) { |
|
|
|
|
for (String key : headers.keySet()) { |
|
|
|
|
if (HttpHeaders.COOKIE.equalsIgnoreCase(key)) OkCookieJar.sync(url, headers.get(key)); |
|
|
|
|
if (HttpHeaders.USER_AGENT.equalsIgnoreCase(key)) getSettings().setUserAgentString(headers.get(key)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|