81,092
社区成员
发帖
与我相关
我的任务
分享
public static int getBDZDVisitedNumber(String questionId) {
try {
URL url = new URL("http://cp.zhidao.baidu.com/v.php?q=" + questionId);
Scanner sc = new Scanner(url.openConnection().getInputStream());
if (sc.hasNextInt()) {
return sc.nextInt();
}
} catch (Exception ex) {
ex.printStackTrace();
}
return -1; // Failed to get the visited number.
}