|
@@ -134,7 +134,8 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
});
|
|
});
|
|
// checkCaptcha(httpClientEntity.getResult());
|
|
// checkCaptcha(httpClientEntity.getResult());
|
|
- if (resultMap.containsKey("captcha")) {
|
|
|
|
|
|
+ String psor = mapper.readTree(httpClientEntity.getResult()).get("data").get("publicFeeds").get("pcursor").asText();
|
|
|
|
+ if (resultMap.containsKey("captcha") || psor == null) {
|
|
ipPool.setStatus(2);
|
|
ipPool.setStatus(2);
|
|
iIpPoolService.updateById(ipPool);
|
|
iIpPoolService.updateById(ipPool);
|
|
return subCommentList(ksid, photoId, rootCommentId, pcursor);
|
|
return subCommentList(ksid, photoId, rootCommentId, pcursor);
|
|
@@ -174,24 +175,28 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
cookieStore.addCookie(basicClientCookie4);
|
|
cookieStore.addCookie(basicClientCookie4);
|
|
HttpClientEntity httpClientEntity = new HttpClientEntity();
|
|
HttpClientEntity httpClientEntity = new HttpClientEntity();
|
|
HttpClientUtils httpClientUtils = new HttpClientUtils();
|
|
HttpClientUtils httpClientUtils = new HttpClientUtils();
|
|
- httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(ipPool));
|
|
|
|
- httpClientEntity.setHeaders(getHeaders());
|
|
|
|
- httpClientEntity.setParams(params);
|
|
|
|
- httpClientEntity.setUrl("https://live.kuaishou.com/graphql");
|
|
|
|
- httpClientEntity.setResult("");
|
|
|
|
- httpClientEntity.setCookieStore(cookieStore);
|
|
|
|
- httpClientEntity = httpClientUtils.callingGraph(httpClientEntity, commentListQuery(photoId, pcursor));
|
|
|
|
try {
|
|
try {
|
|
|
|
+ httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(ipPool));
|
|
|
|
+ httpClientEntity.setHeaders(getHeaders());
|
|
|
|
+ httpClientEntity.setParams(params);
|
|
|
|
+ httpClientEntity.setUrl("https://live.kuaishou.com/graphql");
|
|
|
|
+ httpClientEntity.setResult("");
|
|
|
|
+ httpClientEntity.setCookieStore(cookieStore);
|
|
|
|
+ httpClientEntity = httpClientUtils.callingGraph(httpClientEntity, commentListQuery(photoId, pcursor));
|
|
|
|
+
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
});
|
|
});
|
|
|
|
+ String psor = mapper.readTree(httpClientEntity.getResult()).get("data").get("publicFeeds").get("pcursor").asText();
|
|
// checkCaptcha(httpClientEntity.getResult());
|
|
// checkCaptcha(httpClientEntity.getResult());
|
|
- if (resultMap.containsKey("captcha")) {
|
|
|
|
|
|
+ if (resultMap.containsKey("captcha") || psor == null) {
|
|
ipPool.setStatus(2);
|
|
ipPool.setStatus(2);
|
|
iIpPoolService.updateById(ipPool);
|
|
iIpPoolService.updateById(ipPool);
|
|
return commentList(ksid, photoId, pcursor);
|
|
return commentList(ksid, photoId, pcursor);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
+ ipPool.setStatus(2);
|
|
|
|
+ iIpPoolService.updateById(ipPool);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -244,12 +249,13 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
httpClientEntity.setHeaders(getHeaders());
|
|
httpClientEntity.setHeaders(getHeaders());
|
|
httpClientEntity.setUrl("https://live.kuaishou.com/graphql");
|
|
httpClientEntity.setUrl("https://live.kuaishou.com/graphql");
|
|
httpClientEntity = httpClientUtils.callingGraph(httpClientEntity, videoFeeds(kuaishouUserCookie.getEid(), pcursor));
|
|
httpClientEntity = httpClientUtils.callingGraph(httpClientEntity, videoFeeds(kuaishouUserCookie.getEid(), pcursor));
|
|
- String result = httpClientEntity.getResult();
|
|
|
|
- Map<String, String> map = getTTfNumber(kuaishouUserCookie);
|
|
|
|
- for (String key : map.keySet()) {
|
|
|
|
- result = result.replace(key, map.get(key));
|
|
|
|
- }
|
|
|
|
try {
|
|
try {
|
|
|
|
+ String result = httpClientEntity.getResult();
|
|
|
|
+ Map<String, String> map = getTTfNumber(kuaishouUserCookie);
|
|
|
|
+ for (String key : map.keySet()) {
|
|
|
|
+ result = result.replace(key, map.get(key));
|
|
|
|
+ }
|
|
|
|
+
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
resultMap = mapper.readValue(result, new TypeReference<Map<String, Object>>() {
|
|
resultMap = mapper.readValue(result, new TypeReference<Map<String, Object>>() {
|
|
});
|
|
});
|
|
@@ -260,6 +266,8 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
return videoList(ksid, pcursor);
|
|
return videoList(ksid, pcursor);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
+ ipPool.setStatus(2);
|
|
|
|
+ iIpPoolService.updateById(ipPool);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -317,6 +325,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
queryWrapper.eq("ksid", ksid);
|
|
queryWrapper.eq("ksid", ksid);
|
|
KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
|
|
KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
|
|
if (kuaishouUserCookie != null) {
|
|
if (kuaishouUserCookie != null) {
|
|
|
|
+ IpPool ipPool = iIpPoolService.getAvaliableIp();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
params.put("photoId", photoId);
|
|
params.put("photoId", photoId);
|
|
params.put("commentId", commentId);
|
|
params.put("commentId", commentId);
|
|
@@ -327,7 +336,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
headers.put("kpf", "PC_WEB");
|
|
headers.put("kpf", "PC_WEB");
|
|
HttpClientEntity httpClientEntity = new HttpClientEntity();
|
|
HttpClientEntity httpClientEntity = new HttpClientEntity();
|
|
HttpClientUtils httpClientUtils = new HttpClientUtils();
|
|
HttpClientUtils httpClientUtils = new HttpClientUtils();
|
|
- httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(null));
|
|
|
|
|
|
+ httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(ipPool));
|
|
httpClientEntity.setUrl("https://live.kuaishou.com/rest/wd/comment/delete");
|
|
httpClientEntity.setUrl("https://live.kuaishou.com/rest/wd/comment/delete");
|
|
httpClientEntity.setResult("");
|
|
httpClientEntity.setResult("");
|
|
httpClientEntity.setCookieStore(cookieTransfer(kuaishouUserCookie.getCookie()));
|
|
httpClientEntity.setCookieStore(cookieTransfer(kuaishouUserCookie.getCookie()));
|
|
@@ -346,6 +355,11 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
});
|
|
});
|
|
|
|
+ if (((Integer) resultMap.get("result")) == 109) {
|
|
|
|
+ ipPool.setStatus(2);
|
|
|
|
+ iIpPoolService.updateById(ipPool);
|
|
|
|
+ return commentDelete(ksid, photoId, commentId);
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@@ -353,7 +367,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|
|
- public Map<String, Object> commentAdd(String ksid, String photoId, String principalId, String content, Long replyToCommentId, Long replyTo) {
|
|
|
|
|
|
+ public Map<String, Object> commentAdd(String ksid, String photoId, String content, Long replyToCommentId, Long replyTo) {
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
|
|
QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
@@ -361,9 +375,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
queryWrapper.eq("ksid", ksid);
|
|
queryWrapper.eq("ksid", ksid);
|
|
KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
|
|
KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
|
|
if (kuaishouUserCookie != null) {
|
|
if (kuaishouUserCookie != null) {
|
|
|
|
+ IpPool ipPool = iIpPoolService.getAvaliableIp();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
params.put("photoId", photoId);
|
|
params.put("photoId", photoId);
|
|
- params.put("principalId", principalId);
|
|
|
|
|
|
+ params.put("principalId", kuaishouUserCookie.getEid());
|
|
params.put("content", content);
|
|
params.put("content", content);
|
|
params.put("replyToCommentId", replyToCommentId);
|
|
params.put("replyToCommentId", replyToCommentId);
|
|
params.put("replyTo", replyTo);
|
|
params.put("replyTo", replyTo);
|
|
@@ -374,9 +389,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
System.out.println(new Gson().toJson(params));
|
|
System.out.println(new Gson().toJson(params));
|
|
HttpClientEntity httpClientEntity = new HttpClientEntity();
|
|
HttpClientEntity httpClientEntity = new HttpClientEntity();
|
|
HttpClientUtils httpClientUtils = new HttpClientUtils();
|
|
HttpClientUtils httpClientUtils = new HttpClientUtils();
|
|
- httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(null));
|
|
|
|
|
|
+ httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(ipPool));
|
|
httpClientEntity.setUrl("https://live.kuaishou.com/rest/wd/photo/comment/add");
|
|
httpClientEntity.setUrl("https://live.kuaishou.com/rest/wd/photo/comment/add");
|
|
httpClientEntity.setResult("");
|
|
httpClientEntity.setResult("");
|
|
|
|
+ httpClientEntity.setCookieStore(cookieTransfer(kuaishouUserCookie.getCookie()));
|
|
List<Cookie> list = httpClientEntity.getCookieStore().getCookies();
|
|
List<Cookie> list = httpClientEntity.getCookieStore().getCookies();
|
|
String did = "";
|
|
String did = "";
|
|
for (Cookie ck : list) {
|
|
for (Cookie ck : list) {
|
|
@@ -392,6 +408,11 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
|
|
});
|
|
});
|
|
|
|
+ if (((Integer) resultMap.get("result")) == 109) {
|
|
|
|
+ ipPool.setStatus(2);
|
|
|
|
+ iIpPoolService.updateById(ipPool);
|
|
|
|
+ return commentAdd(ksid, photoId, content, replyToCommentId, replyTo);
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|