|
|
@@ -166,6 +166,7 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
|
|
|
String searchUrl = null;
|
|
|
Elements itembSelects = null;
|
|
|
try {
|
|
|
+ String javbusCodeUrl = null;
|
|
|
if ("javbus".equals(website)) {
|
|
|
String javbusUrl = javbusUrlList.get((int) (0 + Math.random() * (javbusUrlList.size())));
|
|
|
searchUrl = javbusUrl.concat("/search/").concat(crawlerLoveFoot.getName()).concat("&parent=ce");
|
|
|
@@ -205,16 +206,28 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
|
|
|
try {
|
|
|
searchDocument = JsoupUtil.requestDocument(searchUrl, JsoupUtil.HTTP_GET, proxy, null, null, null);
|
|
|
} catch (Exception eeee) {
|
|
|
- throw new BusinessException(30000, "javbus search result null");
|
|
|
+ // throw new BusinessException(30000, "javbus search result null");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- itembSelects = searchDocument.select("div#waterfall").select("div.item");
|
|
|
+ if (null == searchDocument) {
|
|
|
+ if (crawlerLoveFoot.getIdentificationCode().length() < 32) {
|
|
|
+ javbusCodeUrl = javbusUrl.concat("/").concat(crawlerLoveFoot.getIdentificationCode());
|
|
|
+ itembSelects = new Elements();
|
|
|
+ } else {
|
|
|
+ throw new BusinessException(30000, "javbus search result null");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ itembSelects = searchDocument.select("div#waterfall").select("div.item");
|
|
|
+ if (itembSelects.size() == 0) {
|
|
|
+ throw new BusinessException(30000, "javbus search result null");
|
|
|
+ }
|
|
|
|
|
|
- if (itembSelects.size() == 0) {
|
|
|
- throw new BusinessException(30000, "javbus search result null");
|
|
|
+ if (crawlerLoveFoot.getIdentificationCode().length() < 32) {
|
|
|
+ javbusCodeUrl = javbusUrl.concat("/").concat(crawlerLoveFoot.getIdentificationCode());
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("javdb".equals(website)) {
|
|
|
searchUrl = javdbConstantMap.get("javdb").concat("search?q=").concat(crawlerLoveFoot.getName()).concat("&f=all");
|
|
|
@@ -267,6 +280,12 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(codeUrl) && StringUtils.isNotEmpty(javbusCodeUrl)) {
|
|
|
+ codeUrl = javbusCodeUrl;
|
|
|
+ crawlerLoveFoot.setChangeTitleFlag(1);
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isEmpty(codeUrl)) {
|
|
|
throw new BusinessException(30000, "javbus search result mismatch");
|
|
|
}
|
|
|
@@ -715,7 +734,7 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
|
|
|
long start = System.currentTimeMillis();
|
|
|
Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
|
|
|
|
- String fileName = issueDate.concat(" ").concat(h3);
|
|
|
+ String fileName = issueDate.concat(" ").concat(h3).replace("/", "_");
|
|
|
byte[] imgUrlBytes = fileName.getBytes(StandardCharsets.UTF_8);
|
|
|
if (imgUrlBytes.length > 251) {
|
|
|
byte[] imgUrlDestBytes = new byte[251];
|