Support web parse from

pull/123/head
FongMi 3 years ago
parent da8d041f86
commit f813b0d4c3
  1. 2
      app/src/main/java/com/fongmi/android/tv/player/parse/ParseJob.java
  2. 6
      app/src/main/java/com/fongmi/android/tv/ui/custom/CustomWebView.java

@ -140,7 +140,7 @@ public class ParseJob {
}
private void startWeb(String key, Parse item, String webUrl, Callback callback) {
webViews.add(CustomWebView.create(App.get()).start(key, item.getUrl() + webUrl, item.getHeaders(), callback));
webViews.add(CustomWebView.create(App.get()).start(key, item.getName(), item.getUrl() + webUrl, item.getHeaders(), callback));
}
private HashMap<String, String> getHeader(JsonObject object) {

@ -35,6 +35,7 @@ public class CustomWebView extends WebView {
private WebResourceResponse empty;
private List<String> keys;
private Runnable timer;
private String from;
private String key;
public static CustomWebView create(@NonNull Context context) {
@ -70,11 +71,12 @@ public class CustomWebView extends WebView {
}
}
public CustomWebView start(String key, String url, Map<String, String> headers, ParseJob.Callback callback) {
public CustomWebView start(String key, String from, String url, Map<String, String> headers, ParseJob.Callback callback) {
App.post(timer, Constant.TIMEOUT_PARSE_WEB);
this.callback = callback;
setUserAgent(headers);
loadUrl(url, headers);
this.from = from;
this.key = key;
return this;
}
@ -133,7 +135,7 @@ public class CustomWebView extends WebView {
}
private void onSuccess(Map<String, String> news, String url) {
if (callback != null) callback.onParseSuccess(news, url, "");
if (callback != null) callback.onParseSuccess(news, url, from);
callback = null;
stop(false);
}

Loading…
Cancel
Save