/** * achieve the num of people him/her fellowed * * @param doc * @return */ private String getFellowPeopleNum(Document doc) { Elements friendHtml = doc.select("div[id=\"friend\"]"); Elements fellowPeopleNumHtml = null; if (friendHtml != null) { fellowPeopleNumHtml = friendHtml.select("a"); // 关注人数 if (fellowPeopleNumHtml != null) { String fellowPeopleNum = UtilsMethod.findFirstStringByRegex("成员[0-9]+", fellowPeopleNumHtml.text()); if (fellowPeopleNum != null) { fellowPeopleNum = fellowPeopleNum.replaceAll("[\\D]+", ""); if (fellowPeopleNum != null) { return fellowPeopleNum; } else { return null; } } else { return null; } } else { return null; } } else { return null; } }
/** * achieve the person join douban date * * @param doc * @return */ private String getJoinDate(Document doc) { Elements joinDateHtml = doc.select("div[class=\"user-info\"] div[class=\"pl\"]"); if (joinDateHtml != null) { return UtilsMethod.findFirstStringByRegex( "[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}", joinDateHtml.text()); } else { return null; } }
/** * achieve the num of people fellow him/her * * @param doc * @return */ private String getFellowedPeopleNum(Document doc) { Elements friendHtml = doc.select("p[class=\"rev-link\"]"); if (friendHtml != null) { String fellowedPeopleNum = UtilsMethod.findFirstStringByRegex("被[0-9]+人关注", friendHtml.text()); if (fellowedPeopleNum != null) { fellowedPeopleNum = fellowedPeopleNum.replaceAll("[\\D]+", ""); if (fellowedPeopleNum != null) { return fellowedPeopleNum; } else { return null; } } else { return null; } } else { return null; } }