|
@@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -28,6 +29,7 @@ import java.util.List;
|
|
|
* @author yumeng
|
|
|
* 2019年11月12日10:04:00
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class KuaishouAppServiceImpl implements IKuaishouAppService {
|
|
|
@Autowired
|
|
@@ -43,6 +45,7 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
|
|
|
public void adFetch(KuaishouAppAccount kuaishouAppAccount, Integer page) {
|
|
|
String videoFeeds = kuaishouCrawlerService.getVideoFeeds(kuaishouAppAccount, page);
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
+ int i = 0;
|
|
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
|
try {
|
|
|
AppResult appResult = mapper.readValue(videoFeeds, new TypeReference<AppResult>() {
|
|
@@ -76,7 +79,9 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
|
|
|
ad.setHeight(ad.getAdCover().getHeight());
|
|
|
ad.setType(appFeeds.getType());
|
|
|
ad.setAppName(ad.getAppName().replace(".apk","").replace(".APK","").replace("ios","").replace("IOS",""));
|
|
|
+ System.out.println(ad.getAdCover());
|
|
|
appAdService.saveOrUpdate(ad);
|
|
|
+ i++;
|
|
|
try {
|
|
|
KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());
|
|
|
if (kuaishouAdAccount == null) {
|
|
@@ -93,7 +98,7 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ log.info("account:{} 抓取数据个数:{}", kuaishouAppAccount.getId(), i);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|