Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. package main;
  2.  
  3. import java.io.IOException;
  4. import java.io.PrintStream;
  5.  
  6. import org.jsoup.Jsoup;
  7. import org.jsoup.nodes.Document;
  8. import org.jsoup.nodes.Element;
  9. import org.jsoup.select.Elements;
  10.  
  11. public class Scraper {
  12.  
  13. public static void main(String[] args) {
  14. try {
  15. // fetch the document over HTTP
  16. Document doc = Jsoup.connect("http://www.brawlhalla.com/rankings/1v1/1/").get();
  17.  
  18.  
  19. // get the page title
  20. String title = doc.title();
  21. System.out.println("title: " + title);
  22.  
  23.  
  24. PrintStream fileStream = new PrintStream("data.txt");
  25. System.setOut(fileStream);
  26.  
  27.  
  28.  
  29. //get all td div
  30. Elements links = doc.select("td[class]");
  31. for (Element link : links) {
  32.  
  33. System.out.println(" " + link.text());
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40. } catch (IOException e) {
  41. e.printStackTrace();
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement