小编Kel*_*ing的帖子

使用Jsoup访问HTML但收到错误代码503

我一直在尝试访问KissAnime,但是我一直收到此错误:

org.jsoup.HttpStatusException:提取URL时发生HTTP错误。状态= 503

当我尝试另一个URL例如。https://www.google.com/,效果很好。

这是我的asynctask代码:

 @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;
    }
Run Code Online (Sandbox Code Playgroud)

任何想法如何解决这个问题?

html java android jsoup

5
推荐指数
1
解决办法
856
查看次数

标签 统计

android ×1

html ×1

java ×1

jsoup ×1