找资源
This commit is contained in:
parent
20678fea46
commit
eb6f58baa0
|
|
@ -8,6 +8,8 @@ import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Misc;
|
import com.github.catvod.utils.Misc;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
@ -25,6 +27,8 @@ public class Zhaozy extends Spider {
|
||||||
private final Pattern regexAli = Pattern.compile("(https://www.aliyundrive.com/s/[^\"]+)");
|
private final Pattern regexAli = Pattern.compile("(https://www.aliyundrive.com/s/[^\"]+)");
|
||||||
private final Pattern regexVid = Pattern.compile("(\\S+)");
|
private final Pattern regexVid = Pattern.compile("(\\S+)");
|
||||||
private final String siteUrl = "https://zhaoziyuan.la/";
|
private final String siteUrl = "https://zhaoziyuan.la/";
|
||||||
|
private String username = "nikalo8893@bitvoo.com";
|
||||||
|
private String password = "P@ssw0rd";
|
||||||
|
|
||||||
private Map<String, String> getHeader() {
|
private Map<String, String> getHeader() {
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
|
@ -36,8 +40,8 @@ public class Zhaozy extends Spider {
|
||||||
|
|
||||||
private String getCookie() {
|
private String getCookie() {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("username", "nikalo8893@bitvoo.com");
|
params.put("username", username);
|
||||||
params.put("password", "P@ssw0rd");
|
params.put("password", password);
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("User-Agent", Misc.CHROME);
|
headers.put("User-Agent", Misc.CHROME);
|
||||||
headers.put("Referer", siteUrl + "login.html");
|
headers.put("Referer", siteUrl + "login.html");
|
||||||
|
|
@ -51,15 +55,30 @@ public class Zhaozy extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context, String extend) {
|
public void init(Context context, String extend) {
|
||||||
Ali.get().init(extend);
|
String strs[] = extend.split("\\$\\$\\$");
|
||||||
|
String url = strs[0];
|
||||||
|
if (strs.length > 2) {
|
||||||
|
username = strs[1];
|
||||||
|
password = strs[2];
|
||||||
|
}
|
||||||
|
Ali.get().init(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
Matcher matcher = regexAli.matcher(OkHttp.string(siteUrl + ids.get(0), getHeader()));
|
Matcher matcher = regexAli.matcher(OkHttp.string(siteUrl + ids.get(0), getHeader()));
|
||||||
if (!matcher.find()) return "";
|
if (!matcher.find()) return "";
|
||||||
|
String videoId = ids.get(0);
|
||||||
ids.set(0, matcher.group(1));
|
ids.set(0, matcher.group(1));
|
||||||
return Ali.get().detailContent(ids);
|
String json = Ali.get().detailContent(ids);
|
||||||
|
if ("".equals(json)){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
JSONObject result = new JSONObject(json);
|
||||||
|
JSONArray jsonList = result.getJSONArray("list");
|
||||||
|
JSONObject jsonObject = jsonList.getJSONObject(0);
|
||||||
|
jsonObject.put("vod_id",videoId);
|
||||||
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue