6

I have been trying to access KissAnime however, i kept receiving this error:

org.jsoup.HttpStatusException: HTTP error fetching URL. Status=503

When i tried another URL eg. https://www.google.com/, it works perfectly.

This is my asynctask code:

 @Override
    protected Void doInBackground(Void... params) {
        try {
            // Connect to the web site
            Document document = Jsoup.connect("https://kissanime.to/AnimeList/")
                    .ignoreContentType(true)
                    .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1")
                    .referrer("http://www.google.com")
                    .timeout(12000)
                    .followRedirects(true)
                    .get();
            // Get the html document title
            title = document.title();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

Any idea how to solve this problem?

Kelvin Ding
  • 115
  • 10
  • 2
    I think the motivation is the anti-DoS tool [they adopted](https://blog.cloudflare.com/when-the-bad-guys-name-malware-after-you-you/) (look at the `cf_clearance` cookie). – user2340612 Jun 09 '16 at 20:16

1 Answers1

2

To get rid of 503, below code would be useful.

   public static void main(String[] args) throws IOException {
        //This will get you out of Http 503
        Document document = Jsoup.connect("https://kissanime.to/AnimeList/")
                .userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0").ignoreHttpErrors(true).followRedirects(true).timeout(100000).ignoreContentType(true).get();
        System.out.println(document.body());
}