I've been using Jsoup for a long time. I need to get values of a table.
That's the link i'm work on : https://www.kayseri.bel.tr/vefat-ilanlari
The problem here: I can't directly access the values I want.
As you can see at below i need to access table values with item.Adsoyad function.
When i check values with opera developer tools like below i realized i can access values somehow. Now my question is how do I do this.
I only came until this part which returns the code you see in Log.
try { Document document = Jsoup.connect("https://www.kayseri.bel.tr/vefat-ilanlari").timeout(10000).get();
if (document != null) { Elements adiSoyadi = document.select("tbody td[data-th = Adı Soyadı]"); Log.e("loge", "run: " + adiSoyadi.text()); } } catch (IOException e) { e.printStackTrace(); }
Returning value :
E/loge: run: {{item.AdSoyad}}
So if I understand correctly you are succeeding in finding all the table fields that have the attribute data-th
set to Adı Soyadı
as Elements, but you just need to get their text values. You can do that like this (with Java 8 or higher):
List<String> values = adiSoyadi.stream() // streaming all the elements
.map(e -> e.text()) // getting the text from each element
.collect(Collectors.toList()) // collecting the Strings in a list