无法通过使用Jsoup帖子表单获取Document

时间:2015-08-28 09:36:24

标签: jsoup

我想从这个网站抓取公寓列表: 字符串网站= FOSOAuthServerBundle

以下是我尝试使用的代码:

String urlToPropertyList= website +"data/search_list_results";
        Connection.Response loginForm = Jsoup
            .connect(website)
            .method(Connection.Method.GET).execute();
    Document doc = Jsoup
            .connect(urlToPropertyList)
            .data("areaFrom", "0")
            .data("areaTo", "null")
            .data("area_type", "net_area")
            .data("autocompleteString", "")
            .data("bedroom", "")
            .data("bldgIds", "")
            .data("districtIds", "")
            .data("estIds", "")
            .data("estate_name", "")
            .data("feature", "")
            .data("is_hos", "false")
            .data("is_random", "false")
            .data("latLngBounds",
                    "22.409949,113.848296,22.531141,114.374267")
            .data("page", "2").data("priceFrom", "0")
            .data("priceTo", "null").data("sort", "").data("tx_type", "L")
            .data("zoomLevel", "11").cookies(loginForm.cookies())
            .timeout(0).post();

这是我得到的错误:

  

org.jsoup.HttpStatusException:HTTP错误提取URL。状态= 415,   URL = http://en.midland.com.hk/find-property/     在   org.jsoup.helper.HttpConnection $ Response.execute(HttpConnection.java:537)     在   org.jsoup.helper.HttpConnection $ Response.execute(HttpConnection.java:493)     在org.jsoup.helper.HttpConnection.execute(HttpConnection.java:205)     在org.jsoup.helper.HttpConnection.post(HttpConnection.java:200)at   crawlers.MidlandListCrawler.crawl(MidlandListCrawler.java:37)at   main.MidlandRealtyCrawlController.start(MidlandRealtyCrawlController.java:13)     在main.CrawlingController $ 2.run(CrawlingController.java:32)

请求有效负载,从浏览器复制(inspect element - > network - > headers):

{  
   "estate_name":"",
   "priceFrom":0,
   "priceTo":null,
   "areaFrom":null,
   "areaTo":null,
   "bedroom":"",
   "tx_type":"L",
   "area_type":"net_area",
   "is_hos":false,
   "autocompleteString":"",
   "districtIds":"",
   "estIds":"",
   "latLngBounds":"22.40614,113.848296,22.531141,114.374267",
   "page":1,
   "sort":"",
   "bldgIds":"",
   "zoomLevel":11,
   "feature":"",
   "is_random":false
}

有人可以帮助我吗,我怎样才能获得物业清单? 提前致谢

0 个答案:

没有答案