mirror of
https://github.com/bizhangjie/CatVodSpider.git
synced 2025-10-28 02:22:28 +00:00
'更新可用状态'
This commit is contained in:
@@ -62,7 +62,7 @@ public class MainActivity extends Activity {
|
||||
private void initSpider() {
|
||||
try {
|
||||
Init.init(getApplicationContext());
|
||||
spider = new CaoLiu();
|
||||
spider = new MiMei();
|
||||
spider.init(this, "");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@@ -87,7 +87,7 @@ public class MainActivity extends Activity {
|
||||
|
||||
public void categoryContent() {
|
||||
try {
|
||||
Logger.t("categoryContent").d(spider.categoryContent("6", "2", true, new HashMap<>()));
|
||||
Logger.t("categoryContent").d(spider.categoryContent("guochan", "2", true, new HashMap<>()));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class MainActivity extends Activity {
|
||||
|
||||
public void detailContent() {
|
||||
try {
|
||||
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("1716500")));
|
||||
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("/suoyoushipin/guochan/62824.html")));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -103,12 +103,15 @@ public class CaoLiu extends Spider {
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String target = cateUrl + tid + "&page=" + pg;
|
||||
List<Vod> list = new ArrayList<>();
|
||||
|
||||
// 只有图片模版
|
||||
if (tid == "57") {
|
||||
Document doc = Jsoup.parse(OkHttp.string(target, getHeaders()));
|
||||
list = parseHtml(doc);
|
||||
Document doc = Jsoup.parse(OkHttp.string(target, getCookie()));
|
||||
List<Vod> list = parseHtml(doc);
|
||||
Integer total = (Integer.parseInt(pg) + 1) * 20;
|
||||
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, total, list);
|
||||
}
|
||||
List<Vod> list = new ArrayList<>();
|
||||
// 图文结合模版
|
||||
if (tid == "47") {
|
||||
Document doc = Jsoup.parse(OkHttp.string(target, getCookie()));
|
||||
@@ -131,7 +134,6 @@ public class CaoLiu extends Spider {
|
||||
list.add(new Vod(id, name, ""));
|
||||
}
|
||||
}
|
||||
|
||||
Integer total = (Integer.parseInt(pg) + 1) * 20;
|
||||
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, total, list);
|
||||
}
|
||||
|
||||
@@ -37,15 +37,17 @@ public class MiMei extends Spider {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public List<Vod> parseHtml(Document document){
|
||||
public List<Vod> parseHtml(Document document) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element element : document.select("div.pos")) {
|
||||
try {
|
||||
String pic = element.select("img").attr("src");
|
||||
String id = element.select("a").attr("href");
|
||||
String name = element.select("a").attr("title").replace("迷妹推荐--","");
|
||||
list.add(new Vod(id, name, pic));
|
||||
}catch (Exception e){
|
||||
String name = element.select("a").attr("title").replace("迷妹推荐--", "");
|
||||
if (!"".equals(name)) {
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -54,13 +56,13 @@ public class MiMei extends Spider {
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl,getHeaders()));
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
||||
for (Element element : doc.select("div.hend").select("li")) {
|
||||
try {
|
||||
String typeId = element.select("a").attr("href").split("/")[2];
|
||||
String typeName = element.select("a").text();
|
||||
classes.add(new Class(typeId, typeName));
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -71,17 +73,22 @@ public class MiMei extends Spider {
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String target = cateUrl + tid + "/index_" + pg + ".html";
|
||||
String target = cateUrl + tid;
|
||||
if (pg == "1"){
|
||||
target = target + "/";
|
||||
}else {
|
||||
target = target + "/index_" + pg + ".html";
|
||||
}
|
||||
Document doc = Jsoup.parse(OkHttp.string(target, getHeaders()));
|
||||
List<Vod> list = parseHtml(doc);
|
||||
Integer total = (Integer.parseInt(pg)+1)*20;
|
||||
return Result.string(Integer.parseInt(pg),Integer.parseInt(pg)+1,20,total,list);
|
||||
Integer total = (Integer.parseInt(pg) + 1) * 20;
|
||||
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, total, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
Document doc = Jsoup.parse(OkHttp.string(detailUrl.concat(ids.get(0))));
|
||||
String name = doc.select("title").text().replace("迷妹推荐--","");
|
||||
String name = doc.select("title").text().replace("迷妹推荐--", "");
|
||||
|
||||
Pattern pattern = Pattern.compile("vHLSurl = \\\"(.*?)\\\";");
|
||||
Matcher matcher = pattern.matcher(doc.html());
|
||||
@@ -101,7 +108,7 @@ public class MiMei extends Spider {
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String target = searchUrl;
|
||||
Map<String,String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("className", "ed5315ea37ade2181edbd8b27b3fc881");
|
||||
params.put("keyword", key);
|
||||
params.put("page", "1");
|
||||
@@ -113,10 +120,10 @@ public class MiMei extends Spider {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (JsonElement element : array) {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
String title = object.get("title").toString().replace("\"","");
|
||||
String pic = "https://3bmmaeh.life/pic" + object.get("titlepic").toString().replace("\"","");
|
||||
String id = object.get("titleurl").toString().replace("\"","");
|
||||
list.add(new Vod(id,title,pic));
|
||||
String title = object.get("title").toString().replace("\"", "");
|
||||
String pic = "https://3bmmaeh.life/pic" + object.get("titlepic").toString().replace("\"", "");
|
||||
String id = object.get("titleurl").toString().replace("\"", "");
|
||||
list.add(new Vod(id, title, pic));
|
||||
}
|
||||
|
||||
return Result.string(list);
|
||||
|
||||
Reference in New Issue
Block a user