From this table I can get the text, but the links fail

<tr> <td align="center">TEXT1</td> <td><a href="/#">TEXT2</a></td> <td align="right"><b>TEXT3</b></td> </tr> 

Code that does not fully work:

 Element body = document.body(); Elements links = body.getElementsByTag("a"); Elements tr = body.getElementsByTag("tr"); for (Element row :tr) { if (row.select("td").size() == 3) { String nambe = row.select("td").get(0).text(); String table_mini = row.select("td").get(1).text(); String url =row.attr("href"); String praice = row.select("td").get(2).text(); dataTableList.add(new Table_article(nambe, url, table_mini, praice)); } else { // data } } 
  • one
    String url =row.select("td").get(1).select("a").get(0).attr("href"); - Yuriy SPb
  • Thank. The code worked: String url = row.select ("td"). Get (1) .select ("a"). Attr ("href"); - Xelon
  • Give the code to the senses, how can you read it properly? - GenCloud

0