java - HTML Can't Find Table ID -
i trying use jsoup rip table link. new html , can not find right "table id" use. code below, , have gotten work tables other pages, code not issue. don't know how find right table id. thank you!
this html code see: http://pastebin.com/d5h5qbb6
import java.io.ioexception; import org.jsoup.jsoup; import org.jsoup.nodes.document; import org.jsoup.nodes.element; import org.jsoup.select.elements; public class readurl { public static void main(string[] args) { //extracttableusingjsoup("http://mobilereviews.net/details-for-motorola%20l7.htm","phone_details"); extracttableusingjsoup("http://games.espn.go.com/ffl/freeagency?leagueid=1566286&teamid=4&seasonid=2015#&seasonid=2015&view=projections&context=freeagency&avail=-1","insert table id here"); } public static void extracttableusingjsoup(string url, string tableid){ document doc; try { // need http protocol doc = jsoup.connect(url).get(); //set id of table website , below code print contents of table. //set extracted data in appropriate data structures , use them further processing element table = doc.getelementbyid(tableid); elements tds = table.getelementsbytag("td"); //you can check nesting of tds if such structure exists (element td : tds) { system.out.println("\n"+td.text()); } } catch (ioexception e) { e.printstacktrace(); } } }
as output, not looking for. want players , projections.
this table want get
Comments
Post a Comment