use of me.postaddict.instagram.scraper.cookie.DefaultCookieJar in project instagram-java-scraper by postaddictme.
the class AnonymousInstaTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient httpClient = new OkHttpClient.Builder().addNetworkInterceptor(loggingInterceptor).addInterceptor(new UserAgentInterceptor(UserAgents.OSX_CHROME)).addInterceptor(new ErrorInterceptor()).cookieJar(new DefaultCookieJar(new CookieHashSet())).build();
client = new Instagram(httpClient);
client.basePage();
}
use of me.postaddict.instagram.scraper.cookie.DefaultCookieJar in project instagram-java-scraper by postaddictme.
the class AuthenticatedInstaTest method testLoginWithInvalidCredentials.
@Test(expected = InstagramAuthException.class)
public void testLoginWithInvalidCredentials() throws Exception {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
OkHttpClient httpClient = new OkHttpClient.Builder().addNetworkInterceptor(loggingInterceptor).addInterceptor(new UserAgentInterceptor(UserAgents.OSX_CHROME)).addInterceptor(new ErrorInterceptor()).cookieJar(new DefaultCookieJar(new CookieHashSet())).build();
Instagram instagramClient = new Instagram(httpClient);
instagramClient.basePage();
instagramClient.login("1", "2");
}
use of me.postaddict.instagram.scraper.cookie.DefaultCookieJar in project instagram-java-scraper by postaddictme.
the class AuthenticatedInstaTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
Credentials credentials = new Credentials();
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
OkHttpClient httpClient = new OkHttpClient.Builder().addNetworkInterceptor(loggingInterceptor).addInterceptor(new UserAgentInterceptor(UserAgents.OSX_CHROME)).addInterceptor(new ErrorInterceptor()).cookieJar(new DefaultCookieJar(new CookieHashSet())).build();
client = new Instagram(httpClient);
client.basePage();
client.login(credentials.getLogin(), credentials.getPassword());
client.basePage();
}
use of me.postaddict.instagram.scraper.cookie.DefaultCookieJar in project instagram-java-scraper by postaddictme.
the class MultiThreadTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient httpClient = new OkHttpClient.Builder().addNetworkInterceptor(loggingInterceptor).addInterceptor(new UserAgentInterceptor(UserAgents.OSX_CHROME)).addInterceptor(new ErrorInterceptor()).cookieJar(new DefaultCookieJar(new CookieHashSet())).build();
client = new Instagram(httpClient);
client.basePage();
}
use of me.postaddict.instagram.scraper.cookie.DefaultCookieJar 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 UserAgentInterceptor(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