C
C
Crash7x2021-07-03 20:25:33
Android
Crash7x, 2021-07-03 20:25:33

401 jsoup error when connecting?

I'm trying to connect to a site and I'm getting this org.jsoup.HttpStatusException: HTTP error fetching URL. Status=401 in try/catch.

String url="https://www.auchan.ru/";
  
            try {
                doc = (Document) Jsoup.connect(url).userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                        .referrer("http://www.google.com").get();
            } catch (Exception e) {
                Log.d("items", "ошибка "+e );
                return null;
            }

Always connected without problems, but then he asks and I don’t understand what he needs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2021-07-03
@402d

401 Unauthorized
The response code for an HTTP 401 Unauthorized error status from the client indicates that the request was not accepted because it lacked valid credentials for the target resource.
Maybe the site admin got sick of the grabbers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question