|
|
@@ -23,12 +23,14 @@ import top.lvzhiqiang.exception.ParameterException;
|
|
|
import top.lvzhiqiang.mapper.*;
|
|
|
import top.lvzhiqiang.service.BgService;
|
|
|
import top.lvzhiqiang.util.DateUtils;
|
|
|
+import top.lvzhiqiang.util.JsoupUtil;
|
|
|
import top.lvzhiqiang.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.Proxy;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDate;
|
|
|
@@ -458,6 +460,10 @@ public class BgServiceImpl implements BgService {
|
|
|
videoInfo.setIdentificationCode(identificationCode);
|
|
|
String picTime = parseDocument4QiBing(document, identificationCode, qibingPath, videoInfo);
|
|
|
videoInfo.setStatus(2);
|
|
|
+
|
|
|
+ // 获取男优
|
|
|
+ getMaleCast(videoInfo);
|
|
|
+
|
|
|
videoInfoMapper.updateJsoupInfoByCode(videoInfo);
|
|
|
videoInfoOtherMapper.insertOrUpdate(identificationCode, 2);
|
|
|
|
|
|
@@ -480,6 +486,60 @@ public class BgServiceImpl implements BgService {
|
|
|
log.warn("jsoupVideoInfo 统计:total={},success={}", icodeList.size(), j);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getMaleCast(VideoInfo videoInfo) {
|
|
|
+ Document document;
|
|
|
+ try {
|
|
|
+ Map<String,String> headerMap = new HashMap<>();
|
|
|
+ headerMap.put("referer", "avdanyuwiki.com");
|
|
|
+
|
|
|
+ document = JsoupUtil.requestDocument("https://avdanyuwiki.com/?s=".concat(videoInfo.getName()), JsoupUtil.HTTP_GET, Proxy.NO_PROXY, null, headerMap, null);
|
|
|
+
|
|
|
+ Elements container = document.select("div#header-container-in");
|
|
|
+ if (container.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Elements alinks1 = container.select("h4").select("a[rel='bookmark']");
|
|
|
+ if (alinks1 == null || alinks1.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String alinkhref = alinks1.first().attr("abs:href");
|
|
|
+ document = JsoupUtil.requestDocument(alinkhref, JsoupUtil.HTTP_GET, Proxy.NO_PROXY, null, headerMap, null);
|
|
|
+
|
|
|
+ Elements entrycontent = document.select("div.entry-content");
|
|
|
+ if (entrycontent.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String[] entrycontentArr = entrycontent.html().split("<br>");
|
|
|
+ for (String s : entrycontentArr) {
|
|
|
+ if (s.contains("出演男優")) {
|
|
|
+ String[] split = s.split(":");
|
|
|
+ if (split.length < 2) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String maleCasts = s.split(":")[1];
|
|
|
+
|
|
|
+ List<String> sssss = new ArrayList<>();
|
|
|
+ String[] split1 = maleCasts.split(",");
|
|
|
+ for (String s1 : split1) {
|
|
|
+ String[] split2 = s1.trim().split("\\s+");
|
|
|
+ for (String s2 : split2) {
|
|
|
+ sssss.add(s2.replaceAll(" ", "").trim());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String maleCast = StringUtils.join(sssss, ",");
|
|
|
+ videoInfo.setMaleCast(maleCast);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("getMaleCast error,icode={},name={}={}", videoInfo.getIdentificationCode(), videoInfo.getName(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除影片
|
|
|
*
|