|
@@ -135,17 +135,23 @@ public class SpiderJob {
|
|
|
return ReturnT.SUCCESS;
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
}
|
|
|
for (SpiderContent content : contentList) {
|
|
for (SpiderContent content : contentList) {
|
|
|
- String text = null;
|
|
|
|
|
|
|
+ String text = "";
|
|
|
try {
|
|
try {
|
|
|
List<ContentSearchResponse.DataItem> dataItems = spiderApiService.searchContentDetail(content.getTitle());
|
|
List<ContentSearchResponse.DataItem> dataItems = spiderApiService.searchContentDetail(content.getTitle());
|
|
|
if (dataItems != null && !dataItems.isEmpty()) {
|
|
if (dataItems != null && !dataItems.isEmpty()) {
|
|
|
- for (ContentSearchResponse.DataItem dataItem : dataItems) {
|
|
|
|
|
|
|
+ // 取前3条中文本最长的内容
|
|
|
|
|
+ for (int i = 0; i < dataItems.size(); i++) {
|
|
|
|
|
+ if (i >= 3) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ ContentSearchResponse.DataItem dataItem = dataItems.get(i);
|
|
|
if (StringUtils.isNotBlank(dataItem.getContent())) {
|
|
if (StringUtils.isNotBlank(dataItem.getContent())) {
|
|
|
if (dataItem.getContent().length() < 150) {
|
|
if (dataItem.getContent().length() < 150) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- text = dataItem.getContent();
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ if (text.length() < dataItem.getContent().length()) {
|
|
|
|
|
+ text = dataItem.getContent();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|