This may be challenging since the builders of the website seem to trying to block this.
I am trying to build a simple app to view some data from a website table. The table is located here:
http://www.cepteteb.com.tr/doviz-kurlari
However, the table data seems to load after page is loaded, so when I try to get the HTML of table, it comes empty. How do I get the table with data?
I am using JSOUP to scrape the table.
private class GetData extends AsyncTask<String, Void, Element> { @Override protected Element doInBackground(String... params) { try { Document document = Jsoup.connect(params[0]).get(); Log.e("Yiit",document+""); Element table = document.getElementById("dovizTablo"); return table; } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Element element) { super.onPostExecute(element); Log.e("Yiit",element+""); tvMain.setText(element+""); } } Result:
<table class="prices prices2" id="dovizTablo"> <thead> <tr> <th>Döviz Adı</th> <th>CEPTETEB Alış</th> <th>CEPTETEB Satış</th> </tr> </thead> <tbody> </tbody> </table> Expected Behaviour:
<table class="prices prices2" id="dovizTablo"> <thead> <tr> <th>Döviz Adı</th> <th>CEPTETEB Alış</th> <th>CEPTETEB Satış</th> </tr> </thead> <tbody> <tr><td>USD</td><td>2.9096 TL</td><td>2.9908 TL</td></tr><tr><td>EUR</td><td>3.1555 TL</td><td>3.2435 TL</td></tr><tr><td>GBP</td><td>4.0558 TL</td><td>4.1688 TL</td></tr></tbody> </table>