I am trying to make java web scraper but I lost somewhere in the code What is supposed to be done to just extract Name ,Email and phone no form the given webpage.
I am using jsoup library in this too .
But cant able to figure it out how I can achieve this task
This is how my codes look like
package javaapplication6;
import org.jsoup.*;
import org.jsoup.helper.*;
import org.jsoup.nodes.*;
import org.jsoup.select.*;
import java.io.*; // Only needed if scraping a local File.
public class javaapplication6 {
public javaapplication6() {
Document doc = null;
try {
doc = Jsoup.connect("http://cs.qau.edu.pk/faculty.php/").get();
} catch (IOException ioe) {
ioe.printStackTrace();
}
Elements table = doc.getElementsByClass("tbl");
Elements rows = table.getElementsByTag("TR");
for (Element row : rows) {
Elements tds = row.getElementsByTag("TD");
for (int i = 0; i < tds.size(); i++) {
if (i == 1) System.out.println(tds.get(i).text());
}
}
}
public static void main (String args[]) {
new javaapplication6();
}
}