title: Using Jsoup to connect to url, but Jsoup call another url. Why?
body: <p>I tried to use Jsoup to crawl this</p>
  
  <pre><code>Document dok = Jsoup.connect("http://bola.kompas.com/ligaindonesia").userAgent("Mozilla/5.0").timeout(0).get();
  </code></pre>
  
  <p>but error appeared like this:</p>
  
  <pre><code>java.io.IOException: Too many redirects occurred trying to load URL http://m.kompas.com/bola
  </code></pre>
  
  <p>And, when I type this:</p>
  
  <pre><code>Document dok = Jsoup.connect("http://m.kompas.com/bola").userAgent("Mozilla/5.0").timeout(0).get();
  </code></pre>
  
  <p>error appeared like this:</p>
  
  <pre><code>java.io.IOException: Too many redirects occurred trying to load URL http://bola.kompas.com
  </code></pre>
  
  <p>Actually this is my full code:</p>
  
  <pre><code>import java.io.IOException;
  
  import org.jsoup.Connection;
  import org.jsoup.HttpStatusException;
  import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  import org.jsoup.nodes.Element;
  import org.jsoup.select.Elements;
  
  public class MainBackup {
      public static void main(String[] args) throws IOException {
          processCrawling_kompas("http://bola.kompas.com/ligaindonesia");
      }
  
      public static void processCrawling_kompas(String URL){
          try{
              Connection.Response response = Jsoup.connect(URL).timeout(0).execute();
              int statusCode = response.statusCode();
              if(statusCode == 200){
                  Document dok = Jsoup.connect(URL).userAgent("Mozilla/5.0").timeout(0).get();
                  System.out.println("opened page: "+ URL);
  
                  Elements nextPages = dok.select("a");
                  for(Element nextPage: nextPages){
                      if(nextPage != null){
                          if(nextPage.attr("href").contains("bola.kompas.com")){
                              processCrawling_kompas(nextPage.attr("abs:href"));
                          }
                      }
                  }
              }
          }catch (NullPointerException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (HttpStatusException e) {
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>What exactly happened in here? How to solve this?</p>
  
  <p>Thanks for your help before :)</p>