use of me.postaddict.instagram.scraper.interceptor.FakeBrowserInterceptor in project instagram-java-scraper by postaddictme.
the class InstagramFactory method getAuthenticatedInstagramClient.
public static Instagram getAuthenticatedInstagramClient(String login, String password, String userAgent) throws IOException {
OkHttpClient httpClient = new OkHttpClient.Builder().addInterceptor(new FakeBrowserInterceptor(userAgent)).addInterceptor(new ErrorInterceptor()).cookieJar(new DefaultCookieJar(new CookieHashSet())).build();
Instagram client = new Instagram(httpClient);
client.basePage();
client.login(login, password);
client.basePage();
return client;
}
Aggregations