Need: Parse a web page and read the details presented in a table (Web Page to parse - Link)
Issue: I am unable to get the details under tbody section. At present I am only able to get thead details.
Research: I checked with this Link on stack overflow, but unable to figure out in my case.
The HTML table which I need to extract
<table id="industryInfo" class="eq-series tbl-securityinfo cap-hide">
<caption></caption>
<thead>
<tr>
<th>Macro-Economic Sector</th>
<th>Sector</th>
<th>Industry</th>
<th>Basic Industry</th>
</tr>
</thead>
<tbody class="">
<tr>
<td>Commodities</td>
<td>Metals & Mining</td>
<td>Ferrous Metals</td>
<td>Pig Iron</td>
</tr>
</tbody>
</table>
Code:
String url = "https://www.nseindia.com/get-quotes/equity?symbol=ADANIENT";
Document document = new Document(url);
try {
document = Jsoup.connect(url).userAgent("Mozilla/5.0").get();
} catch (IOException e) {
e.printStackTrace();
}
// System.out.println(document);
Elements elements = document.select("#industryInfo");
for (Element element : elements) {
System.out.println(element);
}
Hope the issue faced is clear, any pointers to what I am missing will be helpful