Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package demmonic.hf;
- import java.io.IOException;
- import org.jsoup.Connection;
- import org.jsoup.Jsoup;
- import org.jsoup.nodes.Document;
- import org.jsoup.nodes.Element;
- import org.jsoup.select.Elements;
- /**
- *
- * @author Demmonic
- *
- */
- public final class Entry {
- private Entry() { }
- public static void main(String[] args) throws IOException {
- String link = "http://www.bloomberg.com/quote/UKX:IND/members";
- Connection con = Jsoup.connect(link);
- Document doc = con.get();
- Elements entries = doc.select(".odd");
- for (Element e : entries) {
- Elements nameChildren = e.select("[class=first name]");
- Element nameChild = nameChildren.first();
- if (nameChild == null) continue;
- // there's actually 2 children with the value class, but we only want the first one
- Elements valueChildren = e.select(".value");
- Element valueChild = valueChildren.first();
- if (valueChild == null) continue;
- String name = nameChild.text();
- String value = valueChild.text();
- System.out.println(name + " -> " + value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment