|
|
@@ -20,7 +20,6 @@ import top.lvzhiqiang.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
-import java.net.Proxy;
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
@@ -153,6 +152,7 @@ public class BgServiceImpl implements BgService {
|
|
|
Document document;
|
|
|
VideoInfoPool videoInfoPool;
|
|
|
String javbusUrl;
|
|
|
+ int j = 0;
|
|
|
for (int i = 0; i < icodePoolList.size(); i++) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
@@ -172,7 +172,7 @@ public class BgServiceImpl implements BgService {
|
|
|
while (retryCount <= 3) {
|
|
|
javbusUrl = javbusUrlList.get((int) (0 + Math.random() * (javbusUrlList.size() - 0)));
|
|
|
try {
|
|
|
- document = Jsoup.connect(javbusUrl.concat(identificationCode)).timeout(50000).userAgent(getUserAgent()).get();
|
|
|
+ document = Jsoup.connect(javbusUrl.concat(identificationCode)).timeout(50000).header("referer", "https://www.javbus.com/".concat(identificationCode)).userAgent(getUserAgent()).get();
|
|
|
|
|
|
videoInfoPool = new VideoInfoPool();
|
|
|
long picTime = parseDocument(document, identificationCode, machiPath, videoInfoPool);
|
|
|
@@ -181,6 +181,8 @@ public class BgServiceImpl implements BgService {
|
|
|
icodePool.setRetryCount(retryCount);
|
|
|
icodePoolMapper.updateStatus(icodePool);
|
|
|
videoInfoPoolMapper.insert(videoInfoPool);
|
|
|
+
|
|
|
+ j++;
|
|
|
}
|
|
|
|
|
|
log.info("jsoupIcodePool success:i={},picTime={},time={},identificationCode={}", i, picTime, System.currentTimeMillis() - start, identificationCode);
|
|
|
@@ -192,7 +194,7 @@ public class BgServiceImpl implements BgService {
|
|
|
log.error("jsoupIcodePool error重试:i={},retryCount={},time={},identificationCode={}", i, retryCount, System.currentTimeMillis() - start, identificationCode, e);
|
|
|
} else if (retryCount == 4) {
|
|
|
icodePool.setStatus(3);
|
|
|
- icodePool.setRetryCount(retryCount);
|
|
|
+ icodePool.setRetryCount(retryCount - 1);
|
|
|
icodePool.setFailureCause(e.getMessage().length() <= 200 ? e.getMessage() : e.getMessage().substring(0, 200));
|
|
|
icodePoolMapper.updateStatus(icodePool);
|
|
|
log.error("jsoupIcodePool error:i={},time={},identificationCode={}", i, System.currentTimeMillis() - start, identificationCode, e);
|
|
|
@@ -200,6 +202,7 @@ public class BgServiceImpl implements BgService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ log.info("jsoupIcodePool 统计:total={},success={}", icodePoolList.size(), j);
|
|
|
}
|
|
|
|
|
|
private String getUserAgent() {
|
|
|
@@ -218,8 +221,9 @@ public class BgServiceImpl implements BgService {
|
|
|
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",
|
|
|
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 SE 2.X MetaSr 1.0",
|
|
|
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36 TheWorld 7",
|
|
|
- "Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/60.0"};
|
|
|
- int i = r.nextInt(14);
|
|
|
+ "Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/60.0",
|
|
|
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"};
|
|
|
+ int i = r.nextInt(15);
|
|
|
return ua[i];
|
|
|
}
|
|
|
|