Update py config like js

pull/178/head
FongMi 2 years ago
parent 0ada98fbc1
commit 866e0bd7ee
  1. 2
      app/src/main/java/com/fongmi/android/tv/api/ApiConfig.java
  2. 2
      app/src/main/java/com/fongmi/android/tv/api/PyLoader.java
  3. 4
      pyramid/src/main/java/com/undcover/freedom/pyramid/Loader.java

@ -230,7 +230,7 @@ public class ApiConfig {
public Spider getSpider(Site site) {
boolean js = site.getApi().contains(".js");
boolean py = site.getApi().startsWith("py_");
boolean py = site.getApi().contains(".py");
boolean csp = site.getApi().startsWith("csp_");
if (py) return pyLoader.getSpider(site.getKey(), site.getApi(), site.getExt());
else if (js) return jsLoader.getSpider(site.getKey(), site.getApi(), site.getExt(), site.getJar());

@ -41,7 +41,7 @@ public class PyLoader {
try {
if (spiders.containsKey(key)) return spiders.get(key);
Method method = loader.getClass().getMethod("spider", Context.class, String.class, String.class);
Spider spider = (Spider) method.invoke(loader, App.get(), api.split("py_")[1], ext);
Spider spider = (Spider) method.invoke(loader, App.get(), key, api);
spider.init(App.get(), ext);
spiders.put(key, spider);
return spider;

@ -22,9 +22,9 @@ public class Loader {
}
@Keep
public Spider spider(Context context, String name, String ext) {
public Spider spider(Context context, String name, String api) {
if (app == null) init(context);
PyObject obj = app.callAttr("init_py", cache, name, ext);
PyObject obj = app.callAttr("init_py", cache, name, api);
return new Spider(app, obj);
}
}

Loading…
Cancel
Save