通过带有Java的JSoup自动登录网站?

时间:2018-11-24 22:41:28

标签: java web login jsoup

我想通过Java登录到Netflix帐户,但是我的代码不起作用。你能帮我找到问题吗?

setProxy(proxy, port);
String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36";

Connection.Response loginForm = Jsoup.connect("https://www.netflix.com/de/login").data("userLoginId", email, "password", password)
        .userAgent(userAgent).method(Method.POST).execute();

Map<String, String> map = loginForm.cookies();

Document doc = Jsoup.connect("https://www.netflix.com/de/login").followRedirects(true).cookies(map).get();

String body = doc.body().text();

0 个答案:

没有答案