Web Scraping with Jsoup, Unable to get search results

Viewed 56

I am trying to scrape the Donor's list from the website https://www.friends2support.org/inner/news/searchresult.aspx, but unable to get the search results page. Can anyone give a look at my code and see what is wrong.

        Connection.Response Form = Jsoup.connect(URL)
        .method(Connection.Method.GET)
        .userAgent(USER_AGENT)
        .execute();
        Document Doc = Form.parse();

        HashMap<String, String> cookies = new HashMap<>(Form.cookies());

        HashMap<String, String> searchData = new HashMap<>();
        searchData.put("dpBloodGroup", "O+");
        searchData.put("dpCountry", "1|dpCountry");
        searchData.put("dpState", "4|dpState");
        searchData.put("dpDistrict", "0|dpDistrict");
        searchData.put("dpCity", "0|dpCity");
        searchData.put("btnSearchButton", "Submit");

        Connection.Response result = Jsoup.connect(URL)
                .cookies(cookies)
                .data(searchData)
                .method(Connection.Method.POST)
                .userAgent(USER_AGENT)
                .execute();

        System.out.println(result.parse().html());
0 Answers
Related