Ejemplo n.º 1
0
  public static String getAccFriends(MainExcel.AccountObj accountObj) throws Exception {
    String accountId = accountObj.id;
    String accountTokken = accountObj.token;
    String count;

    String uri;
    JSONObject responseArray;

    try {
      uri =
          "https://api.vk.com/method/friends.get?user_id="
              + accountId
              + "&count=1&v=5.24&access_token="
              + accountTokken;
      responseArray = (MainRequest.getRequestJson(uri));

      count = ((JSONObject) responseArray.get("response")).get("count").toString();

    } catch (NullPointerException e) {
      System.out.println("getCountMyFriends.NullPointerException" + e.getMessage());
      e.printStackTrace();
      //            count = CheckerFunc.getAccFriends(accountObj);
      count = "0";
    }
    return count;
  }
Ejemplo n.º 2
0
  public static String getAccStatus(MainExcel.AccountObj accountObj) throws Exception {
    String accountId = accountObj.id;
    String accountTokken = accountObj.token;
    String status = null;

    String uri;
    String response;

    uri = "https://vk.com/id" + accountId;
    response = (MainRequest.postRequest(uri, ""));

    Pattern pZam = Pattern.compile(".*<b>temporarily</b>.*");
    Matcher mZam = pZam.matcher(response);
    boolean temporarily = mZam.matches();

    Pattern pBan = Pattern.compile(".*<b>block</b>.*");
    Matcher mBan = pBan.matcher(response);
    boolean block = mBan.matches();

    if (temporarily == true) {
      status = "Зам";
    }

    if (block == true) {
      status = "Блок";
    }

    if ((temporarily == false) && (block == false)) {
      status = "Ok";
    }

    return status;
  }