title: Web Scraping with Jsoup only functioning half the time
body: <p>I've been playing around with the Java Jsoup library lately in an attempt to get a better understanding of web scraping (pulling data off a website). But it would seem that the code I managed to put together only functions part of the time. Is the issue with my code, or is it possible that certain sites have measures to stop web scraping?</p>
  
  <p>Here is the class that does all the 'magic' :</p>
  
  <pre><code>import java.io.IOException;
  import org.jsoup.*;
  import org.jsoup.nodes.Document;
  
  
  
  
  public class HTMLParser {
  
  private Document d;
  private String url;
  private String content;
  
  
  
      public HTMLParser(String url){
      this.url = url; 
       connect();
       parse();
       display();
  
      }
  
  
      private void connect(){ 
          try{
          d = Jsoup.connect(url).get();   
          }catch(IOException e){}
      }
  
      private void parse(){
          content = d.body().text();
  
      }
  
      private void display(){
          System.out.println(content);
  
      }
  
  }
  </code></pre>