1

This is an screenshot of site

i am using following code

        @Override
    protected Void doInBackground(Void... params) {
        try {
            Connection.Response baglanilan = Jsoup.connect("http://www.eshot.gov.tr/tr/UlasimSaatleri/288")
                    .method(Connection.Method.GET)
                    .execute();
            Document document = Jsoup.connect("http://www.eshot.gov.tr/tr/UlasimSaatleri/288").data("hatId","581").cookies(baglanilan.cookies()).post();

                Elements bakiye = document.select("#frmDuraklar > ul > li");
                veri1ad = bakiye.toString();

        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);
        progressDialog.dismiss();
        tvveri.setText(veri1ad);
    }

code getting:

<li class="ring" id="10504">Fahrettin Altay</li>
<li class="ring" id="10507">İkinci Oyak Sitesi</li>
<li class="ring" id="10505">Ordu Pazarı</li>
<li class="ring" id="10506">Mehmet&ccedil;ik</li>
.
.
.

I need only id list from result. How can i parse just a id list?

1
  • what response "bakiye"? Commented Aug 28, 2016 at 23:47

1 Answer 1

1

You have almost near to output and forgot to iterate the elements

  try {
            Connection.Response baglanilan = Jsoup.connect("http://www.eshot.gov.tr/tr/UlasimSaatleri/288")
                    .method(Connection.Method.GET)
                    .execute();
            Document document = Jsoup.connect("http://www.eshot.gov.tr/tr/UlasimSaatleri/288").data("hatId","581").cookies(baglanilan.cookies()).post();


            Elements elements = document.select("#frmDuraklar > ul > li");

             for (Element element : elements) {
                 System.out.println(element.attr("id"));
             }



        } catch (IOException e) {
            e.printStackTrace();
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.