Open cemcocu opened 5 years ago
Hello, I added the maven dependency from this link and here is my simple code :
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient httpClient = new OkHttpClient.Builder() .addNetworkInterceptor(loggingInterceptor) .addInterceptor(new ErrorInterceptor()) .cookieJar(new DefaultCookieJar(new CookieHashSet())) .build(); Instagram i=new Instagram(httpClient); Account ac=new Account(); try { ac = i.getAccountByUsername("kevin"); } catch (IOException e) { e.printStackTrace(); } return ac;
I am getting the error : instagram.scraper.exception.InstagramAuthException: Access denied
And this is the output of my instagram object which i named in the code as "i"
--> GET https://www.instagram.com/kevin/?__a=1 http/1.1 Host: www.instagram.com Connection: Keep-Alive Accept-Encoding: gzip User-Agent: okhttp/3.2.0 --> END GET <-- 403 Forbidden https://www.instagram.com/kevin/?__a=1 (337ms) Content-Type: text/html; charset=utf-8 x-robots-tag: noindex Vary: Accept-Language, Cookie Content-Language: en Date: Wed, 20 Mar 2019 20:15:02 GMT Strict-Transport-Security: max-age=31536000 Cache-Control: private, no-cache, no-store, must-revalidate Pragma: no-cache Expires: Sat, 01 Jan 2000 00:00:00 GMT X-Frame-Options: SAMEORIGIN content-security-policy: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' blob: https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests X-Content-Type-Options: nosniff X-XSS-Protection: 0 Set-Cookie: rur=PRN; Domain=.instagram.com; HttpOnly; Path=/; Secure Set-Cookie: mid=XJKfRgAEAAEysr_ICI8XAivb7wLK; Domain=.instagram.com; expires=Sat, 17-Mar-2029 20:15:02 GMT; Max-Age=315360000; Path=/; Secure Set-Cookie: csrftoken=h8hjZ9mPwbM2AkOw8zVY55rpLSNYjtca; Domain=.instagram.com; expires=Wed, 18-Mar-2020 20:15:02 GMT; Max-Age=31449600; Path=/; Secure Connection: keep-alive Content-Length: 0 OkHttp-Sent-Millis: 1553113030160 OkHttp-Received-Millis: 1553113030493 <-- END HTTP (0-byte body)
I checked all issues about this but i didn't find any clear solution.Also same code is working in php scrapper .But i need a solution in java scrapper.
Expecting helps from masters and kings.
Thank you
Hello, I added the maven dependency from this link and here is my simple code :
I am getting the error : instagram.scraper.exception.InstagramAuthException: Access denied
And this is the output of my instagram object which i named in the code as "i"
--> GET https://www.instagram.com/kevin/?__a=1 http/1.1 Host: www.instagram.com Connection: Keep-Alive Accept-Encoding: gzip User-Agent: okhttp/3.2.0 --> END GET <-- 403 Forbidden https://www.instagram.com/kevin/?__a=1 (337ms) Content-Type: text/html; charset=utf-8 x-robots-tag: noindex Vary: Accept-Language, Cookie Content-Language: en Date: Wed, 20 Mar 2019 20:15:02 GMT Strict-Transport-Security: max-age=31536000 Cache-Control: private, no-cache, no-store, must-revalidate Pragma: no-cache Expires: Sat, 01 Jan 2000 00:00:00 GMT X-Frame-Options: SAMEORIGIN content-security-policy: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' blob: https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests X-Content-Type-Options: nosniff X-XSS-Protection: 0 Set-Cookie: rur=PRN; Domain=.instagram.com; HttpOnly; Path=/; Secure Set-Cookie: mid=XJKfRgAEAAEysr_ICI8XAivb7wLK; Domain=.instagram.com; expires=Sat, 17-Mar-2029 20:15:02 GMT; Max-Age=315360000; Path=/; Secure Set-Cookie: csrftoken=h8hjZ9mPwbM2AkOw8zVY55rpLSNYjtca; Domain=.instagram.com; expires=Wed, 18-Mar-2020 20:15:02 GMT; Max-Age=31449600; Path=/; Secure Connection: keep-alive Content-Length: 0 OkHttp-Sent-Millis: 1553113030160 OkHttp-Received-Millis: 1553113030493 <-- END HTTP (0-byte body)
I checked all issues about this but i didn't find any clear solution.Also same code is working in php scrapper .But i need a solution in java scrapper.
Expecting helps from masters and kings.
Thank you