Удачный парсинг фильмов и сериалов с OnlineLife
This commit is contained in:
@@ -41,7 +41,7 @@ public class Onlinelife implements KinoWarez {
|
||||
for (Element element : elements) {
|
||||
Element childElement = element.child(0);
|
||||
String name = childElement.text();
|
||||
String url = childElement.attr("href");
|
||||
String url = "onlinelife/" + (childElement.attr("href").substring(DOMAIN.length()+1));
|
||||
|
||||
if (strong) {
|
||||
Matcher matcher = pattern.matcher(name.toLowerCase());
|
||||
@@ -68,11 +68,12 @@ public class Onlinelife implements KinoWarez {
|
||||
JsonObject jsonObj = new Gson().fromJson(json, JsonObject.class);
|
||||
|
||||
if (jsonObj.has("file")) {
|
||||
return jsonObj.get("file").getAsString();
|
||||
return "{\"file\":\"" + jsonObj.get("file").getAsString() + "\"}";
|
||||
} else if (jsonObj.has("pl")) {
|
||||
return jsonObj.get("pl").getAsString();
|
||||
browser.setEncoding("utf-8");
|
||||
return browser.get(jsonObj.get("pl").getAsString());
|
||||
} else {
|
||||
return "";
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,8 +38,8 @@ public class PlayerServlet extends HttpServlet {
|
||||
req.getPathInfo(), req.getServletPath()));
|
||||
|
||||
KinoWarez kinoWarez = new Onlinelife();
|
||||
String movie_url = kinoWarez.player(req.getPathInfo());
|
||||
model.put("movie_url", movie_url);
|
||||
String json = kinoWarez.player(req.getPathInfo());
|
||||
model.put("json", json);
|
||||
|
||||
resp.setCharacterEncoding("UTF-8");
|
||||
resp.setContentType("text/html;charset=UTF-8");
|
||||
|
||||
Reference in New Issue
Block a user