Instagram Java Scraper. Get account information, photos and videos without any authorization.
Instagram instagram = new Instagram(httpClient);
Account account = instagram.getAccountByUsername("kevin");
System.out.println(account.getMedia().getCount());
Instagram instagram = new Instagram(httpClient);
Account account = instagram.getAccountById(3);
System.out.println(account.getFullName());
PageObject<Media> medias = instagram.getMedias("durov", 1);
System.out.println(medias.getNodes().get(0).getDisplayUrl());
Media media = instagram.getMediaByUrl("BGY0zB4r7X2");
System.out.println(media.getOwner().getUsername());
Media media = instagram.getMediaByUrl("https://www.instagram.com/p/BGY0zB4r7X2");
System.out.println(media.getOwner().getUsername());
MediaUtil.getCodeFromId("1270593720437182847_3");
// OR
MediaUtil.getCodeFromId("1270593720437182847");
// Output: BGiDkHAgBF_
// So you can do like this: instagram.com/p/BGiDkHAgBF_
MediaUtil.getIdFromCode('BGiDkHAgBF_');
// Output: 1270593720437182847
- Mark project repository by star on github
- Make pull request with bug fix
- Follow project contributors
Released as com.github.igor-suhorukov:instagramscraper:2.2 into maven central
Read more info on jitpack page of project. Open "Commit" tab and select revision by commit hash. Just open Gradle or Maven tab copy artifact info and place it with dendency management repository in your project build configuration
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again.
If instagram-java-scraper IDE compilation failing because of all the missing getters/setters. Just setup lombok plugin for IntelliJ Idea, Eclipse or Netbeans
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();
PHP library: https://github.com/postaddictme/instagram-php-scraper