上开心网,浪费越来越多的时间,最近使用Java版Google App Engine,开发了一个开心网外挂,这样随时随地,登录
开心大盗,就可以直接偷菜了,方便、快捷、开源、免费、放心使用。暂时只支持收获菜地,偷菜,打工
源代码放在Google code中,详细介绍:
http://bit.ly/1Lle0N
关键代码
/**
* 打工
* @param resultBuilder
* @param verifyValue
*/
private void processJob(String verifyValue){
StringBuilder resultBuilder = getHttpContent(URL_PREFIX_HOUSE_JOB+verifyValue);
String result = resultBuilder.toString();
int jobIdPos = result.lastIndexOf("<option value=\"");
String sMaxJobId = findText(result, "<option value=\"", "\"", jobIdPos);
if (sMaxJobId == null) return;
//prepare post
// petid=12&verify=11111_111111_121212829_e33f851c27b60165ac0e7b9156ba01e6_kx
StringBuilder postData = new StringBuilder()
.append("petid=").append(sMaxJobId)
.append("&verify=").append(verifyValue)
;
StringBuilder doJobResult = postHttpContent(URL_PREFIX_HOUSE_JOB_DO, postData.toString(), URL_PREFIX_HOUSE_JOB+verifyValue);
if (doJobResult==null) return;
String sDoJobResult = findText(doJobResult.toString(), "<div class=\"tips1\">", "<br/>", 0);
logBuilder.append(sDoJobResult).append("\r\n");
}
收获菜地
private void harvest(String url){
StringBuilder resultBuilder = getHttpContent(url);
if (resultBuilder!=null){
String sGarden = resultBuilder.toString();
//收获
int indexUrl = sGarden.indexOf("garden/havest.php?");
String havestUrl = null;
while((havestUrl=findText(sGarden, "garden/havest.php?", "\"", indexUrl))!=null){
indexUrl = sGarden.indexOf("garden/havest.php?", indexUrl)+1;
havestUrl = URL_PREFIX_HOUSE_GARDEN_HAVEST+havestUrl;
havestUrl = havestUrl.replaceAll("&", "&");
StringBuilder havestBuilder = getHttpContent(havestUrl);
if (havestBuilder != null){
String sHavest = havestBuilder.toString();
String what = findText(sHavest, "你已经收获了", "</div>", 0);
if (what != null){
logBuilder.append("收获了"+what).append("\r\n");
}
else{
what = findText(sHavest, "你已经成功偷到", "</div>", 0);
if (what != null){
logBuilder.append("偷到"+what).append("\r\n");
}
}
}
}
}
}