ansheng 大佬有话说 :
分享个Java版HostLoc签到
迫于论坛没有Java版的,小白撸了一个,分享给大家
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import java.io.IOException;
import java.util.Map;
public class HostLocSignIn {
public static void main(String[] args) throws IOException {
String UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
Map<String, String> cookies = Jsoup.connect("https://www.hostloc.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1")
.method(Connection.Method.POST)
.data("fastloginfield", "username")
.data("quickforward", "yes")
.data("handlekey", "1s")
.data("username", "USERNAME")
.data("password", "PASSWORD")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding", "gzip, deflate, sdch")
.header("Accept-Language", "zh-CN,zh;q=0.8,en;q=0.6")
.header("Host", "www.hostloc.com")
.header("Referer", "https://www.hostloc.com/forum.php")
.header("Upgrade-Insecure-Requests", "1")
.userAgent(UserAgent)
.execute()
.cookies();
String currentMoney = Jsoup.connect("https://www.hostloc.com/home.php?mod=spacecp&ac=credit")
.userAgent(UserAgent)
.cookies(cookies)
.get()
.select("#extcreditmenu")
.text();
for (int i = 20350; i <= 20370; i++) {
Jsoup.connect(String.format("https://www.hostloc.com/space-uid-%s.html", i)).userAgent(UserAgent).cookies(cookies).get();
}
String newMoney = Jsoup.connect("https://www.hostloc.com/home.php?mod=spacecp&ac=credit")
.userAgent(UserAgent)
.cookies(cookies)
.get()
.select("#extcreditmenu")
.text();
System.out.println(String.format("%s to %s", currentMoney, newMoney));
}
}
jeff 大佬有话说 :
以前有个java版,但是没php方便 没人用就凉了
古藤君 大佬有话说 :
需要这么多header…
ansheng 大佬有话说 :
古藤君 大佬有话说 : 2020-2-4 14:46
需要这么多header…
我之前用Python的写了这么多,我也就加上去了