Explorar o código

筋斗云手机接码工具类

hcst_sunzhen %!s(int64=5) %!d(string=hai) anos
pai
achega
8120ce316f

+ 29 - 17
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/JindouyunMobileUtil.java

@@ -32,7 +32,7 @@ public class JindouyunMobileUtil {
     public static String getPhone(String sid, String token) throws Exception{
         String phone = domainUrl + getPhone + "?sid=" + sid + "&token=" + token;
         String result = HttpUtils.httpGetRequest(phone);   //成功示例:0|手机号|运营商|省份|城市  0|16533852954|虚拟运营商|未知|未知|19359933
-        if(result != null && result.startsWith("1")){
+        if(result != null && result.startsWith("0")){
             return result.split("\\|")[1];
         }else{
             throw new Exception();
@@ -45,6 +45,7 @@ public class JindouyunMobileUtil {
     public static String getMessage(String sid, String phone, String token) throws Exception{
         String message = domainUrl + getMessage + "?sid=" + sid + "&phone=" + phone + "&token=" + token;
         String result = HttpUtils.httpGetRequest(message);   //成功示例:0|您的验证码是123456|123456
+        System.out.println(result);
         if(result != null && result.startsWith("0")){
             return result.split("\\|")[2];
         }else{
@@ -56,8 +57,8 @@ public class JindouyunMobileUtil {
     //释放号码
     public static String cancelRecv(String sid, String phone, String token) throws Exception{
         String cancel = domainUrl + cancelRecv + "?sid=" + sid + "&phone=" + phone + "&token=" + token;
-        String result = HttpUtils.httpGetRequest(cancel);
-        if(result != null && result.startsWith("1")){
+        String result = HttpUtils.httpGetRequest(cancel);  //成功示例 :0|释放成功
+        if(result != null && result.startsWith("0")){
             return result.split("\\|")[1];
         }else{
             throw new Exception();
@@ -67,8 +68,8 @@ public class JindouyunMobileUtil {
     //加黑号码
     public static String addBlacklist(String sid, String phone, String token) throws Exception{
         String blackList = domainUrl + addBlacklist + "?sid=" + sid + "&phone=" + phone + "&token=" + token;
-        String result = HttpUtils.httpGetRequest(blackList);
-        if(result!=null && result.startsWith("\\|")){
+        String result = HttpUtils.httpGetRequest(blackList);  //成功示例:0|加黑成功
+        if(result!=null && result.startsWith("0")){
             return result.split("\\|")[1];
         }else{
             throw new Exception();
@@ -76,18 +77,29 @@ public class JindouyunMobileUtil {
     }
 
     public static void main(String[] args) {
-        JindouyunMobileUtil j = new JindouyunMobileUtil();
-        try{
-            login();
-
-
-
-
-        }catch (Exception e){
-
-        }
-
-
+        //String sid = "308";
+        //try{
+        //    String token = login();
+        //    String phone = getPhone(sid, token);
+        //
+        //    int times = 0;
+        //    while (times <= 100){
+        //        try {
+        //            String msg = getMessage(sid, phone, token);
+        //            System.out.println(msg);
+        //            break;
+        //        }catch (Exception e){
+        //        }
+        //        Thread.sleep(5000L);
+        //        times++;
+        //    }
+        //    //
+        //    //cancelRecv(sid, phone, token);
+        //    //addBlacklist(sid, phone, token);
+        //}catch (Exception e){
+        //    System.out.println(e.getMessage());
+        //    e.printStackTrace();
+        //}
     }
 
 }