Add javdb/hsck
This commit is contained in:
parent
6a1f0c6298
commit
3138913014
|
|
@ -0,0 +1,61 @@
|
||||||
|
name: Spider
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: set up JDK
|
||||||
|
uses: actions/setup-java@v3.11.0
|
||||||
|
with:
|
||||||
|
java-version: '18'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Clone project
|
||||||
|
run: |
|
||||||
|
rm -rf project
|
||||||
|
rm -rf jar/custom_spider.jar
|
||||||
|
git clone --recurse-submodules https://github.com/fatkun/CatVodSpider project
|
||||||
|
|
||||||
|
# - name: Customize Spider
|
||||||
|
# working-directory: ./project
|
||||||
|
# run: |
|
||||||
|
# sed -i 's/gradle-7.4.2-all/gradle-7.5-bin/g' gradle/wrapper/gradle-wrapper.properties
|
||||||
|
|
||||||
|
- name: Build the app
|
||||||
|
working-directory: ./project
|
||||||
|
run: |
|
||||||
|
chmod +x gradlew
|
||||||
|
./gradlew assemblerelease --build-cache --parallel --daemon --warning-mode all
|
||||||
|
|
||||||
|
- name: Customize Spider Jar
|
||||||
|
working-directory: ./project
|
||||||
|
run: |
|
||||||
|
rm -rf jar/custom_spider.jar
|
||||||
|
rm -rf jar/spider.jar/original/META-INF
|
||||||
|
curl -L https://github.com/iBotPeaches/Apktool/releases/download/v2.7.0/apktool_2.7.0.jar > jar/3rd/apktool_2.7.0.jar
|
||||||
|
java -jar jar/3rd/baksmali-2.5.2.jar d app/build/intermediates/dex/release/minifyReleaseWithR8/classes.dex -o jar/Smali_classes
|
||||||
|
mkdir -p jar/spider.jar/smali/com/github/catvod/
|
||||||
|
mv jar/Smali_classes/com/github/catvod/spider jar/spider.jar/smali/com/github/catvod/
|
||||||
|
java -jar jar/3rd/apktool_2.7.0.jar b jar/spider.jar -c
|
||||||
|
mv jar/spider.jar/dist/dex.jar ../jar/custom_spider.jar
|
||||||
|
#md5=($(md5sum ../jar/custom_spider.jar))
|
||||||
|
echo $(md5sum ../jar/custom_spider.jar | awk '{print $1}') > ../jar/custom_spider.jar.md5
|
||||||
|
|
||||||
|
- name: Upload APK
|
||||||
|
uses: actions/upload-artifact@v3.1.2
|
||||||
|
with:
|
||||||
|
name: Spider
|
||||||
|
path: ./jar/custom_spider.jar
|
||||||
|
|
||||||
|
- name: Update spider jar
|
||||||
|
uses: EndBug/add-and-commit@v9.1.3
|
||||||
|
with:
|
||||||
|
default_author: github_actions
|
||||||
|
message: 'update spider jar'
|
||||||
|
add: "['./jar/custom_spider.jar', './jar/custom_spider.jar.md5']"
|
||||||
|
|
@ -22,6 +22,14 @@
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".debug.Test18AVActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
@ -6,6 +6,7 @@ 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.Hsck;
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.spider.Yingshiche;
|
import com.github.catvod.spider.Yingshiche;
|
||||||
import com.orhanobut.logger.AndroidLogAdapter;
|
import com.orhanobut.logger.AndroidLogAdapter;
|
||||||
|
|
@ -46,7 +47,7 @@ public class MainActivity extends Activity {
|
||||||
private void initSpider() {
|
private void initSpider() {
|
||||||
try {
|
try {
|
||||||
Init.init(getApplicationContext());
|
Init.init(getApplicationContext());
|
||||||
spider = new Yingshiche();
|
spider = new Hsck();
|
||||||
spider.init(this, "");
|
spider.init(this, "");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -71,7 +72,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
public void categoryContent() {
|
public void categoryContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("categoryContent").d(spider.categoryContent("tid", "1", true, new HashMap<>()));
|
Logger.t("categoryContent").d(spider.categoryContent("8", "1", true, new HashMap<>()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +80,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
public void detailContent() {
|
public void detailContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("/voddetail/5553.html")));
|
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("http://hsck770.cc/vodplay/42872-1-1.html")));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.github.catvod.debug;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.github.catvod.R;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.spider.A18av;
|
||||||
|
import com.github.catvod.spider.Hsck;
|
||||||
|
import com.github.catvod.spider.Init;
|
||||||
|
import com.orhanobut.logger.AndroidLogAdapter;
|
||||||
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class Test18AVActivity extends Activity {
|
||||||
|
|
||||||
|
private ExecutorService executor;
|
||||||
|
private Spider spider;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
Button homeContent = findViewById(R.id.homeContent);
|
||||||
|
Button homeVideoContent = findViewById(R.id.homeVideoContent);
|
||||||
|
Button categoryContent = findViewById(R.id.categoryContent);
|
||||||
|
Button detailContent = findViewById(R.id.detailContent);
|
||||||
|
Button playerContent = findViewById(R.id.playerContent);
|
||||||
|
Button searchContent = findViewById(R.id.searchContent);
|
||||||
|
homeContent.setOnClickListener(view -> executor.execute(this::homeContent));
|
||||||
|
homeVideoContent.setOnClickListener(view -> executor.execute(this::homeVideoContent));
|
||||||
|
categoryContent.setOnClickListener(view -> executor.execute(this::categoryContent));
|
||||||
|
detailContent.setOnClickListener(view -> executor.execute(this::detailContent));
|
||||||
|
playerContent.setOnClickListener(view -> executor.execute(this::playerContent));
|
||||||
|
searchContent.setOnClickListener(view -> executor.execute(this::searchContent));
|
||||||
|
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||||
|
executor = Executors.newCachedThreadPool();
|
||||||
|
executor.execute(this::initSpider);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSpider() {
|
||||||
|
try {
|
||||||
|
Init.init(getApplicationContext());
|
||||||
|
spider = new A18av();
|
||||||
|
spider.init(this, "");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void homeContent() {
|
||||||
|
try {
|
||||||
|
Logger.t("homeContent").d(spider.homeContent(true));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void homeVideoContent() {
|
||||||
|
try {
|
||||||
|
Logger.t("homeVideoContent").d(spider.homeVideoContent());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void categoryContent() {
|
||||||
|
try {
|
||||||
|
Logger.t("categoryContent").d(spider.categoryContent("zh/chinese_list/all", "1", true, new HashMap<>()));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void detailContent() {
|
||||||
|
try {
|
||||||
|
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("https://mjv002.com/zh/chinese_content/49105/SNIS-815.html")));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playerContent() {
|
||||||
|
try {
|
||||||
|
Logger.t("playerContent").d(spider.playerContent("轉存原畫", "kahf2rw5Uuk+652f55f6943ee2f75d8e4fa590b4ec65fd007f8c", new ArrayList<>()));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void searchContent() {
|
||||||
|
try {
|
||||||
|
Logger.t("searchContent").d(spider.searchContent("我的人间烟火", false));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.github.catvod.net;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
@ -65,6 +66,10 @@ public class OkHttp {
|
||||||
return url.startsWith("http") ? new OkRequest(GET, url, params, header).execute(client).getBody() : "";
|
return url.startsWith("http") ? new OkRequest(GET, url, params, header).execute(client).getBody() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OkResult get(String url, Map<String, String> header) {
|
||||||
|
return new OkRequest(GET, url, new HashMap<>(), header).execute(client());
|
||||||
|
}
|
||||||
|
|
||||||
public static String post(String url, Map<String, String> params) {
|
public static String post(String url, Map<String, String> params) {
|
||||||
return post(client(), url, params, null).getBody();
|
return post(client(), url, params, null).getBody();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.github.catvod.bean.Class;
|
||||||
|
import com.github.catvod.bean.Result;
|
||||||
|
import com.github.catvod.bean.Vod;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.net.OkHttp;
|
||||||
|
import com.github.catvod.utils.Util;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Qile
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class A18av extends Spider {
|
||||||
|
|
||||||
|
private String siteUrl = "https://mjv002.com";
|
||||||
|
//private String siteUrl = "https://18av.mm-cg.com";
|
||||||
|
private String cookie = "";
|
||||||
|
@Override
|
||||||
|
public void init(Context context, String extend) throws Exception {
|
||||||
|
cookie = getCookie();
|
||||||
|
if(!extend.isEmpty())
|
||||||
|
siteUrl = extend;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getHeader() {
|
||||||
|
Map<String, String> header = new HashMap<>();
|
||||||
|
header.put("User-Agent", Util.CHROME);
|
||||||
|
header.put("Referer", siteUrl+"/");
|
||||||
|
header.put("Cookie", cookie);
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean filter) throws Exception {
|
||||||
|
List<Class> classes = new ArrayList<>();
|
||||||
|
List<String> typeIds = Arrays.asList("/zh/chinese_list/all");
|
||||||
|
List<String> typeNames = Arrays.asList("中文");
|
||||||
|
for (int i = 0; i < typeIds.size(); i++)
|
||||||
|
classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||||
|
return Result.string(classes, fetchVodList(siteUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend)
|
||||||
|
throws Exception {
|
||||||
|
String cateUrl = getPageUrl(siteUrl + tid, pg);
|
||||||
|
return Result.string(fetchVodList(cateUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vod> fetchVodList(String url) {
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeader()));
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Element li : doc.select("div.post")) {
|
||||||
|
String vid = li.select("h3 a").attr("href");
|
||||||
|
String name = li.select("h3").text();
|
||||||
|
String pic = li.select("img").attr("src");
|
||||||
|
String remarks = String.format("%s", li.select(".meta").text());
|
||||||
|
list.add(new Vod(vid, name, pic, remarks));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(ids.get(0), getHeader()));
|
||||||
|
if(doc.text().contains("歡迎登入")) return Result.error("该资源需要登入");
|
||||||
|
List<String> vodItems = new ArrayList<>();
|
||||||
|
Elements sourceList = doc.select(".item.columns");
|
||||||
|
for (Element a : sourceList) {
|
||||||
|
String episodeUrl = a.select("div a").attr("href");
|
||||||
|
String episodeName = a.select("div a").text();
|
||||||
|
vodItems.add(episodeName + "$" + episodeUrl);
|
||||||
|
}
|
||||||
|
Elements elements = doc.select(".panel-block");
|
||||||
|
String classifyName = "";
|
||||||
|
String year = "";
|
||||||
|
String area = "";
|
||||||
|
String remark = "";
|
||||||
|
String actors = "";
|
||||||
|
for (Element element : elements) {
|
||||||
|
String text = element.text();
|
||||||
|
if (text.startsWith("類別:")) {
|
||||||
|
classifyName = element.select("span a").text();
|
||||||
|
} else if (text.startsWith("片商:")) {
|
||||||
|
area = element.select("span a").text();
|
||||||
|
} else if (text.startsWith("日期:")) {
|
||||||
|
year = element.select("span").text();
|
||||||
|
} else if (text.startsWith("評分:")) {
|
||||||
|
remark = element.select("span").text();
|
||||||
|
} else if (text.startsWith("演員:")) {
|
||||||
|
actors = element.select("span").text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(ids.get(0));
|
||||||
|
vod.setVodYear(year);
|
||||||
|
vod.setVodArea(area);
|
||||||
|
vod.setVodRemarks(remark);
|
||||||
|
vod.setTypeName(classifyName);
|
||||||
|
vod.setVodContent(String.format("网址:%s\n类别:%s\n演员:%s", ids.get(0), classifyName, actors));
|
||||||
|
vod.setVodPlayFrom("磁力");
|
||||||
|
vod.setVodPlayUrl(TextUtils.join("#", vodItems));
|
||||||
|
return Result.string(vod);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean quick) throws Exception {
|
||||||
|
String searchUrl = siteUrl + "/search?q=" + Uri.encode(key) + "&f=all";
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(searchUrl, getHeader()));
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Element li : doc.select(".item")) {
|
||||||
|
String vid = siteUrl + li.select("a").attr("href");
|
||||||
|
String name = li.select("a").attr("title");
|
||||||
|
String pic = li.select("img").attr("src");
|
||||||
|
list.add(new Vod(vid, name, pic));
|
||||||
|
}
|
||||||
|
return Result.string(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
|
return Result.get().url(id).header(getHeader()).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPageUrl(String urlPrefix, String pg) {
|
||||||
|
return String.format("%s/%s.html", urlPrefix, pg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCookie() {
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", Util.CHROME);
|
||||||
|
headers.put("Referer", siteUrl);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Map<String, List<String>> resp = OkHttp.get(siteUrl + "/zh/chinese_IamOverEighteenYearsOld/19/index.html", headers).getResp();
|
||||||
|
for (String item : resp.get("set-cookie")) sb.append(item.split(";")[0]).append(";");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,149 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.github.catvod.bean.Class;
|
||||||
|
import com.github.catvod.bean.Result;
|
||||||
|
import com.github.catvod.bean.Vod;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.net.OkHttp;
|
||||||
|
import com.github.catvod.utils.Util;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class Hsck extends Spider {
|
||||||
|
private String siteUrl = "http://hsck.net";
|
||||||
|
Pattern playUrlPattern = Pattern.compile(".*(https:\\\\/\\\\/[a-zA-Z0-9-]+.cdn2020\\.com.*\\.m3u8).*");
|
||||||
|
// 重定向的地址
|
||||||
|
Pattern redirectPattern = Pattern.compile(".*strU=\\\"(https:\\/\\/.*?\\/).*");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Context context, String extend) throws Exception {
|
||||||
|
if(!extend.isEmpty()) {
|
||||||
|
this.siteUrl = extend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getHeader() {
|
||||||
|
Map<String, String> header = new HashMap<>();
|
||||||
|
header.put("User-Agent", Util.CHROME);
|
||||||
|
header.put("Referer", siteUrl+"/");
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkRealLocation(String content) throws IOException {
|
||||||
|
if (content.contains("id=\"hao123\"")) {
|
||||||
|
Matcher matcher = redirectPattern.matcher(content);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
String url = matcher.group(1);
|
||||||
|
String redirectUrl = String.format("%s?u=http://hsck.net&p=", url);
|
||||||
|
this.siteUrl = OkHttp.getLocation(redirectUrl, getHeader());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean filter) throws Exception {
|
||||||
|
|
||||||
|
List<Vod> list = fetchVodList("", "");
|
||||||
|
List<Class> classes = new ArrayList<>();
|
||||||
|
List<String> typeIds = Arrays.asList("15", "8", "9", "10", "7", "21", "22", "");
|
||||||
|
List<String> typeNames = Arrays.asList("国产", "日本无码中文", "日本有码中文", "日本无码", "日本有码", "欧美", "动漫", siteUrl);
|
||||||
|
for (int i = 0; i < typeIds.size(); i++)
|
||||||
|
classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||||
|
return Result.string(classes, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
|
return Result.string(fetchVodList(tid, pg));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPageUrl(String tid, String page) {
|
||||||
|
if ("".equals(tid)) {
|
||||||
|
return siteUrl;
|
||||||
|
}
|
||||||
|
if ("".equals(page)) page = "1";
|
||||||
|
return String.format("%s/vodtype/%s-%s.html", siteUrl, tid, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vod> fetchVodList(String tid, String pg) throws IOException {
|
||||||
|
String url = getPageUrl(tid, pg);
|
||||||
|
String content = OkHttp.string(url, getHeader());
|
||||||
|
boolean urlIsChanged = checkRealLocation(content);
|
||||||
|
if (urlIsChanged) {
|
||||||
|
url = getPageUrl(tid, pg);
|
||||||
|
content = OkHttp.string(url, getHeader());
|
||||||
|
}
|
||||||
|
|
||||||
|
Document doc = Jsoup.parse(content);
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Element li : doc.select("ul.stui-vodlist li")) {
|
||||||
|
String href = li.select("a.stui-vodlist__thumb").attr("href");
|
||||||
|
if (!href.startsWith("/")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String vid = this.siteUrl + href;
|
||||||
|
String name = li.select(".stui-vodlist__detail a").text();
|
||||||
|
String pic = li.select("a.stui-vodlist__thumb").attr("data-original");
|
||||||
|
String remarks = "";
|
||||||
|
list.add(new Vod(vid, name, pic, remarks));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
|
String url = ids.get(0);
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeader()));
|
||||||
|
String playUrl = getPlayUrl(doc);
|
||||||
|
|
||||||
|
List<String> vodItems = new ArrayList<>();
|
||||||
|
vodItems.add("播放$" + playUrl);
|
||||||
|
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(ids.get(0));
|
||||||
|
vod.setVodYear("");
|
||||||
|
vod.setVodArea("");
|
||||||
|
vod.setVodRemarks("");
|
||||||
|
vod.setTypeName("");
|
||||||
|
vod.setVodContent(String.format("网址:%s\n播放地址:%s", url, playUrl));
|
||||||
|
vod.setVodPlayFrom("磁力");
|
||||||
|
vod.setVodPlayUrl(TextUtils.join("#", vodItems));
|
||||||
|
|
||||||
|
return Result.string(vod);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
|
return Result.get().url(id).header(getHeader()).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayUrl(Document doc) {
|
||||||
|
for (Element script : doc.select("script")) {
|
||||||
|
String content = script.html();
|
||||||
|
if (content.contains("player_aaaa")) {
|
||||||
|
Matcher matcher = playUrlPattern.matcher(content);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
return matcher.group(1).replace("\\/", "/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,11 +11,13 @@ import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -28,7 +30,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public class JavDb extends Spider {
|
public class JavDb extends Spider {
|
||||||
|
|
||||||
private static String siteUrl = "https://javdb523.com";
|
private static String siteUrl = "https://javdb524.com";
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context, String extend) throws Exception {
|
public void init(Context context, String extend) throws Exception {
|
||||||
if(!extend.isEmpty())
|
if(!extend.isEmpty())
|
||||||
|
|
@ -45,40 +47,48 @@ public class JavDb extends Spider {
|
||||||
@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<String> typeIds = Arrays.asList("", "censored", "uncensored", "western");
|
List<String> typeIds = Arrays.asList("censored", "uncensored", "western",
|
||||||
List<String> typeNames = Arrays.asList("全部", "有码", "无码", "欧美");
|
"rankings/movies?p=daily&t=censored",
|
||||||
|
"rankings/movies?p=weekly&t=censored",
|
||||||
|
"rankings/movies?p=daily&t=uncensored",
|
||||||
|
"rankings/movies?p=weekly&t=uncensored");
|
||||||
|
List<String> typeNames = Arrays.asList("有码", "无码", "欧美", "有码日榜", "有码周榜", "无码日榜", "无码周榜");
|
||||||
for (int i = 0; i < typeIds.size(); i++)
|
for (int i = 0; i < typeIds.size(); i++)
|
||||||
classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeader()));
|
return Result.string(classes, fetchVodList(siteUrl));
|
||||||
List<Vod> list = new ArrayList<>();
|
|
||||||
for (Element li : doc.select(".item")) {
|
|
||||||
String vid = siteUrl + li.select("a").attr("href");
|
|
||||||
String name = li.select("a").attr("title");
|
|
||||||
String pic = li.select("img").attr("src");
|
|
||||||
list.add(new Vod(vid, name, pic));
|
|
||||||
}
|
|
||||||
return Result.string(classes, list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend)
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
String cateUrl = siteUrl + String.format("/%s?page=%s", tid, pg);
|
// 排行榜没有分页
|
||||||
Document doc = Jsoup.parse(OkHttp.string(cateUrl, getHeader()));
|
if (tid.contains("rankings") && Integer.parseInt(pg) > 1) {
|
||||||
|
return Result.get().vod(new ArrayList<Vod>()).page().string();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("page", pg);
|
||||||
|
String cateUrl = urlAddParam(siteUrl + String.format("/%s", tid) , params);
|
||||||
|
return Result.string(fetchVodList(cateUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vod> fetchVodList(String url) {
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeader()));
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
for (Element li : doc.select(".item")) {
|
for (Element li : doc.select(".item")) {
|
||||||
String vid = siteUrl + li.select("a").attr("href");
|
String vid = siteUrl + li.select("a").attr("href");
|
||||||
String name = li.select("a").attr("title");
|
String name = li.select(".video-title").text();
|
||||||
String pic = li.select("img").attr("src");
|
String pic = li.select("img").attr("src");
|
||||||
list.add(new Vod(vid, name, pic));
|
String remarks = String.format("%s %s", li.select(".meta").text(), li.select(".score").text());
|
||||||
|
list.add(new Vod(vid, name, pic, remarks));
|
||||||
}
|
}
|
||||||
return Result.string(list);
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
Document doc = Jsoup.parse(OkHttp.string(ids.get(0), getHeader()));
|
Document doc = Jsoup.parse(OkHttp.string(ids.get(0), getHeader()));
|
||||||
if(doc.text().contains("歡迎登入")) return Result.error("该资源需要登入");;
|
if(doc.text().contains("歡迎登入")) return Result.error("该资源需要登入");
|
||||||
List<String> vodItems = new ArrayList<>();
|
List<String> vodItems = new ArrayList<>();
|
||||||
Elements sourceList = doc.select(".item.columns");
|
Elements sourceList = doc.select(".item.columns");
|
||||||
for (Element a : sourceList) {
|
for (Element a : sourceList) {
|
||||||
|
|
@ -91,6 +101,7 @@ public class JavDb extends Spider {
|
||||||
String year = "";
|
String year = "";
|
||||||
String area = "";
|
String area = "";
|
||||||
String remark = "";
|
String remark = "";
|
||||||
|
String actors = "";
|
||||||
for (Element element : elements) {
|
for (Element element : elements) {
|
||||||
String text = element.text();
|
String text = element.text();
|
||||||
if (text.startsWith("類別:")) {
|
if (text.startsWith("類別:")) {
|
||||||
|
|
@ -99,8 +110,10 @@ public class JavDb extends Spider {
|
||||||
area = element.select("span a").text();
|
area = element.select("span a").text();
|
||||||
} else if (text.startsWith("日期:")) {
|
} else if (text.startsWith("日期:")) {
|
||||||
year = element.select("span").text();
|
year = element.select("span").text();
|
||||||
} else if (text.startsWith("時長:")) {
|
} else if (text.startsWith("評分:")) {
|
||||||
remark = element.select("span").text();
|
remark = element.select("span").text();
|
||||||
|
} else if (text.startsWith("演員:")) {
|
||||||
|
actors = element.select("span").text();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vod vod = new Vod();
|
Vod vod = new Vod();
|
||||||
|
|
@ -109,8 +122,8 @@ public class JavDb extends Spider {
|
||||||
vod.setVodArea(area);
|
vod.setVodArea(area);
|
||||||
vod.setVodRemarks(remark);
|
vod.setVodRemarks(remark);
|
||||||
vod.setTypeName(classifyName);
|
vod.setTypeName(classifyName);
|
||||||
vod.setVodContent(ids.get(0));
|
vod.setVodContent(String.format("网址:%s\n类别:%s\n演员:%s", ids.get(0), classifyName, actors));
|
||||||
vod.setVodPlayFrom("Qile");
|
vod.setVodPlayFrom("磁力");
|
||||||
vod.setVodPlayUrl(TextUtils.join("#", vodItems));
|
vod.setVodPlayUrl(TextUtils.join("#", vodItems));
|
||||||
return Result.string(vod);
|
return Result.string(vod);
|
||||||
}
|
}
|
||||||
|
|
@ -133,4 +146,18 @@ public class JavDb extends Spider {
|
||||||
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().url(id).header(getHeader()).string();
|
return Result.get().url(id).header(getHeader()).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String urlAddParam(String url, Map<String, String> params) {
|
||||||
|
if (params == null) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri uri = Uri.parse(url);
|
||||||
|
Uri.Builder builder = uri.buildUpon();
|
||||||
|
for (String key : params.keySet()) {
|
||||||
|
String val = params.get(key);
|
||||||
|
builder.appendQueryParameter(key, val);
|
||||||
|
}
|
||||||
|
return builder.build().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
|
import com.github.catvod.net.OkHttp;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JavDb2 extends Spider {
|
||||||
|
|
||||||
|
private static String siteUrl = "https://javdb524.com";
|
||||||
|
@Override
|
||||||
|
public void init(Context context, String extend) throws Exception {
|
||||||
|
super.init(context, extend);
|
||||||
|
if(!extend.isEmpty()){
|
||||||
|
this.siteUrl = extend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 爬虫headers
|
||||||
|
*/
|
||||||
|
private static HashMap<String, String> getHeaders(String url) {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36");
|
||||||
|
headers.put("Referer", siteUrl+"/");
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean z) throws Exception {
|
||||||
|
try {
|
||||||
|
JSONArray classes = new JSONArray();
|
||||||
|
String[] fenleis = new String[] {"全部", "有码", "无码", "欧美",
|
||||||
|
"有码周榜",
|
||||||
|
"无码周榜"};
|
||||||
|
String[] fenleisval = new String[] {"/", "/censored", "/uncensored", "/western",
|
||||||
|
"/rankings/movies?p=weekly&t=censored",
|
||||||
|
"/rankings/movies?p=weekly&t=uncensored",
|
||||||
|
};
|
||||||
|
//String[] fenleis = "全部&有玛&无玛&欧美&有玛周榜".split("&");
|
||||||
|
//String[] fenleisval = "/&/censored&/uncensored&/western&/rankings/movies?p=weekly&t=censored".split("&");
|
||||||
|
for (int i = 0; i < fenleis.length; i++) {
|
||||||
|
JSONObject fenjson = new JSONObject();
|
||||||
|
fenjson.put("type_id", fenleisval[i]);
|
||||||
|
fenjson.put("type_name", fenleis[i]);
|
||||||
|
fenjson.put("type_flag", "2");
|
||||||
|
classes.put(fenjson);
|
||||||
|
}
|
||||||
|
JSONObject jSONObject4 = new JSONObject();
|
||||||
|
jSONObject4.put("class", classes);
|
||||||
|
if(z) {
|
||||||
|
jSONObject4.put("filters", new JSONObject("{}"));
|
||||||
|
}
|
||||||
|
return jSONObject4.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
|
try {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
JSONArray videos = new JSONArray();
|
||||||
|
if(tid.startsWith("/v/")){
|
||||||
|
if(!pg.equals("1")) return "";
|
||||||
|
String webUrl = siteUrl+tid;
|
||||||
|
String html = OkHttp.string(webUrl, getHeaders(siteUrl));
|
||||||
|
Document doc = Jsoup.parse(html);
|
||||||
|
String cover = doc.select("div.column-video-cover img").attr("src");
|
||||||
|
String vodtitle = doc.select("div.video-detail>h2").text();
|
||||||
|
if(html.contains("id=\"magnets-content")){
|
||||||
|
Elements lists = doc.select("div#magnets-content div.item");
|
||||||
|
for (int i = 0; i < lists.size(); i++) {
|
||||||
|
Element vod = lists.get(i);
|
||||||
|
//String title = vod.select("a").text();
|
||||||
|
String title = vod.select("a span.meta").text() + " " + vod.select("a span.name").text();
|
||||||
|
String link = vod.select("a").attr("href");
|
||||||
|
JSONObject v = new JSONObject();
|
||||||
|
v.put("vod_tag", "file");
|
||||||
|
v.put("vod_pic", "");
|
||||||
|
v.put("vod_id", vodtitle+"$$$"+cover+"$$$"+link);
|
||||||
|
v.put("vod_name", title);
|
||||||
|
videos.put(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
String webUrl = siteUrl+tid+"?page="+pg;
|
||||||
|
String html = OkHttp.string(webUrl, getHeaders(siteUrl));
|
||||||
|
Document doc = Jsoup.parse(html);
|
||||||
|
|
||||||
|
Elements list = doc.select("div.movie-list div.item");
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
Element vod = list.get(i);
|
||||||
|
String title = vod.select(".video-title").text();
|
||||||
|
String cover = vod.select("img").attr("src");
|
||||||
|
String remarks = vod.select(".meta").text();
|
||||||
|
String id = vod.select("a").attr("href");
|
||||||
|
JSONObject v = new JSONObject();
|
||||||
|
v.put("vod_tag", "folder");
|
||||||
|
v.put("vod_id", id);
|
||||||
|
v.put("vod_name", title);
|
||||||
|
v.put("vod_pic", cover);
|
||||||
|
v.put("vod_remarks", remarks);
|
||||||
|
videos.put(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("page", pg);
|
||||||
|
result.put("pagecount", Integer.MAX_VALUE);
|
||||||
|
result.put("limit", videos.length());
|
||||||
|
result.put("total", Integer.MAX_VALUE);
|
||||||
|
result.put("list", videos);
|
||||||
|
return result.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
|
try {
|
||||||
|
String pgurl = ids.get(0).trim();
|
||||||
|
String cover = pgurl.split("\\$\\$\\$")[1];
|
||||||
|
String url = pgurl.split("\\$\\$\\$")[2];
|
||||||
|
String name = pgurl.split("\\$\\$\\$")[0];
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
JSONArray list = new JSONArray();
|
||||||
|
JSONObject vodAtom = new JSONObject();
|
||||||
|
vodAtom.put("vod_id", pgurl);
|
||||||
|
vodAtom.put("vod_name", !name.equals("") ? name : url);
|
||||||
|
vodAtom.put("vod_pic", cover);
|
||||||
|
vodAtom.put("type_name", "磁力链接");
|
||||||
|
vodAtom.put("vod_content", url);
|
||||||
|
vodAtom.put("vod_play_from", "magnet");
|
||||||
|
vodAtom.put("vod_play_url", "立即播放$" + url);
|
||||||
|
list.put(vodAtom);
|
||||||
|
result.put("list", list);
|
||||||
|
return result.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
|
try {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("url", id);
|
||||||
|
result.put("parse", 0);
|
||||||
|
result.put("playUrl", "");
|
||||||
|
return result.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean quick) throws Exception {
|
||||||
|
try {
|
||||||
|
return "";
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
b3 12 0d 7a 56 20 43 aa 14 d9 2f bf 5a d1 79 ee
|
6b0424b428877822187f0b96df602e38
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue