|  | @@ -134,7 +134,8 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |                  resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |  //                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);
 | 
	
		
			
				|  |  |                      iIpPoolService.updateById(ipPool);
 | 
	
		
			
				|  |  |                      return subCommentList(ksid, photoId, rootCommentId, pcursor);
 | 
	
	
		
			
				|  | @@ -174,24 +175,28 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |              cookieStore.addCookie(basicClientCookie4);
 | 
	
		
			
				|  |  |              HttpClientEntity httpClientEntity = new HttpClientEntity();
 | 
	
		
			
				|  |  |              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 {
 | 
	
		
			
				|  |  | +                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();
 | 
	
		
			
				|  |  |                  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());
 | 
	
		
			
				|  |  | -                if (resultMap.containsKey("captcha")) {
 | 
	
		
			
				|  |  | +                if (resultMap.containsKey("captcha") || psor == null) {
 | 
	
		
			
				|  |  |                      ipPool.setStatus(2);
 | 
	
		
			
				|  |  |                      iIpPoolService.updateById(ipPool);
 | 
	
		
			
				|  |  |                      return commentList(ksid, photoId, pcursor);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  | +                ipPool.setStatus(2);
 | 
	
		
			
				|  |  | +                iIpPoolService.updateById(ipPool);
 | 
	
		
			
				|  |  |                  e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -244,12 +249,13 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |              httpClientEntity.setHeaders(getHeaders());
 | 
	
		
			
				|  |  |              httpClientEntity.setUrl("https://live.kuaishou.com/graphql");
 | 
	
		
			
				|  |  |              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 {
 | 
	
		
			
				|  |  | +                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();
 | 
	
		
			
				|  |  |                  resultMap = mapper.readValue(result, new TypeReference<Map<String, Object>>() {
 | 
	
		
			
				|  |  |                  });
 | 
	
	
		
			
				|  | @@ -260,6 +266,8 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |                      return videoList(ksid, pcursor);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  | +                ipPool.setStatus(2);
 | 
	
		
			
				|  |  | +                iIpPoolService.updateById(ipPool);
 | 
	
		
			
				|  |  |                  e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -317,6 +325,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |          queryWrapper.eq("ksid", ksid);
 | 
	
		
			
				|  |  |          KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
 | 
	
		
			
				|  |  |          if (kuaishouUserCookie != null) {
 | 
	
		
			
				|  |  | +            IpPool ipPool = iIpPoolService.getAvaliableIp();
 | 
	
		
			
				|  |  |              Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |              params.put("photoId", photoId);
 | 
	
		
			
				|  |  |              params.put("commentId", commentId);
 | 
	
	
		
			
				|  | @@ -327,7 +336,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |              headers.put("kpf", "PC_WEB");
 | 
	
		
			
				|  |  |              HttpClientEntity httpClientEntity = new HttpClientEntity();
 | 
	
		
			
				|  |  |              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.setResult("");
 | 
	
		
			
				|  |  |              httpClientEntity.setCookieStore(cookieTransfer(kuaishouUserCookie.getCookie()));
 | 
	
	
		
			
				|  | @@ -346,6 +355,11 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |                  ObjectMapper mapper = new ObjectMapper();
 | 
	
		
			
				|  |  |                  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) {
 | 
	
		
			
				|  |  |                  e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -353,7 +367,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |          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();
 | 
	
		
			
				|  |  |          QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
 | 
	
		
			
				|  |  |          Map<String, Object> resultMap = new HashMap<>();
 | 
	
	
		
			
				|  | @@ -361,9 +375,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |          queryWrapper.eq("ksid", ksid);
 | 
	
		
			
				|  |  |          KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
 | 
	
		
			
				|  |  |          if (kuaishouUserCookie != null) {
 | 
	
		
			
				|  |  | +            IpPool ipPool = iIpPoolService.getAvaliableIp();
 | 
	
		
			
				|  |  |              Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |              params.put("photoId", photoId);
 | 
	
		
			
				|  |  | -            params.put("principalId", principalId);
 | 
	
		
			
				|  |  | +            params.put("principalId", kuaishouUserCookie.getEid());
 | 
	
		
			
				|  |  |              params.put("content", content);
 | 
	
		
			
				|  |  |              params.put("replyToCommentId", replyToCommentId);
 | 
	
		
			
				|  |  |              params.put("replyTo", replyTo);
 | 
	
	
		
			
				|  | @@ -374,9 +389,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |              System.out.println(new Gson().toJson(params));
 | 
	
		
			
				|  |  |              HttpClientEntity httpClientEntity = new HttpClientEntity();
 | 
	
		
			
				|  |  |              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.setResult("");
 | 
	
		
			
				|  |  | +            httpClientEntity.setCookieStore(cookieTransfer(kuaishouUserCookie.getCookie()));
 | 
	
		
			
				|  |  |              List<Cookie> list = httpClientEntity.getCookieStore().getCookies();
 | 
	
		
			
				|  |  |              String did = "";
 | 
	
		
			
				|  |  |              for (Cookie ck : list) {
 | 
	
	
		
			
				|  | @@ -392,6 +408,11 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 | 
	
		
			
				|  |  |                  ObjectMapper mapper = new ObjectMapper();
 | 
	
		
			
				|  |  |                  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) {
 | 
	
		
			
				|  |  |                  e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 |