Fix 18
This commit is contained in:
parent
7885f33752
commit
d3ae4fec7a
|
|
@ -6,8 +6,8 @@ import android.widget.Button;
|
||||||
|
|
||||||
import com.github.catvod.R;
|
import com.github.catvod.R;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.spider.Eighteen;
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.spider.Star;
|
|
||||||
import com.orhanobut.logger.AndroidLogAdapter;
|
import com.orhanobut.logger.AndroidLogAdapter;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class MainActivity extends Activity {
|
||||||
private void initSpider() {
|
private void initSpider() {
|
||||||
try {
|
try {
|
||||||
Init.init(getApplicationContext());
|
Init.init(getApplicationContext());
|
||||||
spider = new Star();
|
spider = new Eighteen();
|
||||||
spider.init(this, "");
|
spider.init(this, "");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.github.catvod.spider;
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.webkit.CookieManager;
|
||||||
|
|
||||||
import com.github.catvod.bean.Class;
|
import com.github.catvod.bean.Class;
|
||||||
import com.github.catvod.bean.Result;
|
import com.github.catvod.bean.Result;
|
||||||
import com.github.catvod.bean.Vod;
|
import com.github.catvod.bean.Vod;
|
||||||
|
|
@ -13,16 +16,38 @@ import org.jsoup.nodes.Element;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Eighteen extends Spider {
|
public class Eighteen extends Spider {
|
||||||
|
|
||||||
private final String url = "https://maa1815.com/zh/";
|
private final String url = "https://mjv002.com/zh/";
|
||||||
|
private String cookie;
|
||||||
|
|
||||||
|
private void getCookie() {
|
||||||
|
try {
|
||||||
|
cookie = OkHttp.newCall("https://mjv002.com/zh/chinese_IamOverEighteenYearsOld/19/index.html").headers("set-cookie").get(0).split(";")[0];
|
||||||
|
CookieManager.getInstance().setCookie(url, cookie);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getHeader() {
|
||||||
|
Map<String, String> header = new HashMap<>();
|
||||||
|
header.put("Cookie", cookie);
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Context context, String extend) throws Exception {
|
||||||
|
getCookie();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String homeContent(boolean filter) throws Exception {
|
public String homeContent(boolean filter) throws Exception {
|
||||||
List<Class> classes = new ArrayList<>();
|
List<Class> classes = new ArrayList<>();
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
Document doc = Jsoup.parse(OkHttp.string(url));
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeader()));
|
||||||
for (Element a : doc.select("ul.animenu__nav > li > a")) {
|
for (Element a : doc.select("ul.animenu__nav > li > a")) {
|
||||||
String typeName = a.text();
|
String typeName = a.text();
|
||||||
String typeId = a.attr("href").replace(url, "");
|
String typeId = a.attr("href").replace(url, "");
|
||||||
|
|
@ -45,7 +70,7 @@ public class Eighteen extends Spider {
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
tid = tid.replace("random", "list");
|
tid = tid.replace("random", "list");
|
||||||
tid = tid.replace("index", pg);
|
tid = tid.replace("index", pg);
|
||||||
Document doc = Jsoup.parse(OkHttp.string(url + tid));
|
Document doc = Jsoup.parse(OkHttp.string(url + tid, getHeader()));
|
||||||
for (Element div : doc.select("div.post")) {
|
for (Element div : doc.select("div.post")) {
|
||||||
String id = div.select("a").attr("href").replace(url, "");
|
String id = div.select("a").attr("href").replace(url, "");
|
||||||
String name = div.select("h3").text();
|
String name = div.select("h3").text();
|
||||||
|
|
@ -58,7 +83,7 @@ public class Eighteen extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
Document doc = Jsoup.parse(OkHttp.string(url + ids.get(0)));
|
Document doc = Jsoup.parse(OkHttp.string(url + ids.get(0), getHeader()));
|
||||||
Element wrap = doc.select("div.video-wrap").get(0);
|
Element wrap = doc.select("div.video-wrap").get(0);
|
||||||
String name = wrap.select("div.archive-title > h1").text();
|
String name = wrap.select("div.archive-title > h1").text();
|
||||||
String pic = wrap.select("div.player-wrap > img").attr("src");
|
String pic = wrap.select("div.player-wrap > img").attr("src");
|
||||||
|
|
@ -83,7 +108,7 @@ public class Eighteen extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
return Result.get().parse().url(url + id).string();
|
return Result.get().parse().url(url + id).header(getHeader()).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String searchContent(String key, String pg) {
|
private String searchContent(String key, String pg) {
|
||||||
|
|
@ -91,7 +116,7 @@ public class Eighteen extends Spider {
|
||||||
params.put("search_keyword", key);
|
params.put("search_keyword", key);
|
||||||
params.put("search_type", "fc");
|
params.put("search_type", "fc");
|
||||||
params.put("op", "search");
|
params.put("op", "search");
|
||||||
String res = OkHttp.post(url + "searchform_search/all/" + pg + ".html", params);
|
String res = OkHttp.post(url + "searchform_search/all/" + pg + ".html", params, getHeader()).getBody();
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
for (Element div : Jsoup.parse(res).select("div.post")) {
|
for (Element div : Jsoup.parse(res).select("div.post")) {
|
||||||
String id = div.select("a").attr("href").replace(url, "");
|
String id = div.select("a").attr("href").replace(url, "");
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
79ce46d06a14fbf6a8032fb0b1d5b98a
|
4e9c1cca038e839e892c969f1339709e
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue