Code Monkey home page Code Monkey logo

socialinfo4j's Introduction

SocialInfo4J

This repository contains a collection of Java libraries which can be used to fetch data from popular social networks like Facebook, Instagram and LinkedIn. There is a separate repository of mine to fetch data from Twitter.

The libraries I am releasing in this repo are for educational and research purposes only. I have not provided the JAR files. You will have to build it yourself. Also, this repo is NOT affiliated to Facebook, Instagram and LinkedIn. This is my personal research project.

This repo shows different ways with which data can be fetched from an internet service. Official public API is not the only way. Data can be fetched by easily scraping the legacy sites (so that we'll get plain old HTML pages without any JavaScript jargon). Data can also be fetched by using the private APIs, i.e., the API which are meant to be accessed by the Android/iOS apps. By emulating an Android/iOS device through our code, we can easily hit requests to the private API and that spits out the data.

There are many Python libraries that do this kind of stuff but here are my Java libraries to fill up that space!

FacebookScraper4J

This library uses Facebook's legacy page to scrape data.

Code examples

  1. Login to facebook
FacebookScraper facebookScraper=FacebookScraper.builder().username(email).password(password).getInstance();
//You can also use a Proxy. Just use builder().proxy(<proxy instance>)
  1. Get profile information
//this method takes username or userID of your target profile
Profile profile=facebookScraper.getProfile("zuck"); 
  1. Get a list of all the friends of a user
Iterator<List<String>> it=facebookScraper.getFriends(username);
while(it.hasNext()){
    List<String> friendsUsernames=it.next();
    System.out.println(friendsUsernames);
}
  1. Get photos of a user
List<Photo> photos=facebookScraper.getPhotos("zuck");
  1. Search a user
List<MiniProfile> searchResults=facebookScraper.searchUsers("your search query"));

InstagramWrapper4J

This library is a wrapper around instagram4j library which uses Instagram's private API to fetch the data. I have stripped down that library significantly and removed features like Liking a post, Commenting on a post, DMs etc. The goal of my wrapper library is only to fetch the data and not to modifying anything on the server. I have also used OkHttp instead of Apache HttpComponents to make the library Android-friendly.

Code examples

  1. Login to Instagram
Instagram instagram=Instagram.builder().username("your username").password("your password").getInstance();
  1. Get profile information
Profile profile=instagram.getProfile("<username of the target>");
  1. Get user's timeline (photos and videos)
UserTimeline userTimeline =instagram.getUserTimeline("<username of the target>");
  1. Search a user
List<MiniProfile> searchResults =instagram.searchUsers("search query");

LinkedIn4J

This library uses LinkedIn's private API to fetch data.

Code examples

  1. Login to LinkedIn
LinkedIn linkedIn=LinkedIn.builder().username("your email").password("your password").getInstance();
  1. Get profile information
Profile profile=linkedIn.getProfile("<username or publicID of the target>");
  1. Search a user
List<MiniProfile> searchResults=linkedIn.searchProfile("your search query");

TwitterScraper4J

You can visit my another repo for this.

License

CC BY-NC-SA license

The entire code in this repo is released under Creative Commons BY-NC-SA 4.0 license. "This license lets others remix, tweak, and build upon your work non-commercially, as long as they credit you and license their new creations under the identical terms."

socialinfo4j's People

Contributors

nandandesai avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.