周围有**的地方抛出cannot find symbol method getValue()错误。
顺便说一句,代码是检查 minecraft 帐户名称有效性的程序的一部分;它们是否可用。
public String connectToMigrate() {
try {
Connection.Response response =
Jsoup.connect("https://account.mojang.com/migrate").execute();
Document doc = response.parse();
Element authToken = doc.select("input[name^=authenticityToken]").get(0);
Map cookies = response.cookies();
Connection connection =
Jsoup.connect("https://account.mojang.com/migrate/check")
.data("authenticityToken", authToken.val())
.data("mcusername", this.username)
.data("password", this.password)
.method(Connection.Method.POST)
.followRedirects(true);
connection.timeout(10000);
for (Object cookie : cookies.entrySet()) {
connection.cookie((String) **cookie.getValue**(), (String) **cookie.getKey**());
}
Connection.Response postResponse = connection.execute();
if (postResponse.body().toLowerCase().contains("invalid username"))
return "error";
if (postResponse.body().toLowerCase().contains("already been migrated"))
return "error";
if (postResponse.body().toLowerCase().contains("locked out"))
return "error";
if (postResponse.body().toLowerCase().contains("bought minecraft"))
return "error";
if (postResponse.body().toLowerCase().contains("too many failed attempts")) {
getNewProxy();
return "try again";
}
if (postResponse.body().toLowerCase().contains("error")) {
return "try again";
}
Map cookies2 = postResponse.cookies();
Connection connection2 =
Jsoup.connect("https://account.mojang.com/migrate/chooseEmail");
for (Object cookie : cookies2.entrySet()) {
connection2.cookie((String) **cookie.getValue()**, (String) **cookie.getKey()**);
}
connection2.timeout(10000);
Connection.Response postResponse2 = connection2.execute();
String s = postResponse2.body().toLowerCase();
s = s.split("i want to use <strong>")[1];
s = s.split("</strong>")[0];
String email = s;
return email; } catch (Exception e) {
}return "try again";
}