Java怎么模拟登录亚马逊中国网站



 String loginUrl = "https://www.amazon.cn/ap/signin?_encoding=UTF8&openid.assoc_handle=cnflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.cn%2Fgp%2Fcss%2Fhomepage.html%3Fie%3DUTF8%26ref_%3Dnav_yam_ya";

Connection.Response res = Jsoup.connect(loginUrl).data("email", "@163.com", "password", "****", "create", "0").method(Method.POST).execute();

System.out.println(res.url());

Document doc = res.parse();

想要抓取亚马逊的商品信息,但发现一旦抓取多了就需要登录。目前我是用Jsoup模拟登录,找到了form标签,一开始觉得只需POST这三个Map就可以了,但是发现执行后依旧是登录界面,不知道哪里出了问题。我觉得Jsoup底层应该依旧是HttpClient实现的吧,到底怎么通过Jsoup或者HttpClient模拟登录亚马逊中国?

java 模拟登录 jsoup httpclient

真夏D白雪 8 years, 11 months ago

我觉得你还是用代理分散请求靠谱点

小鸡鸡也是动物 answered 8 years, 11 months ago

Your Answer