GithubHelp home page GithubHelp logo

shobeir / graphipy Goto Github PK

View Code? Open in Web Editor NEW
78.0 6.0 16.0 2.97 MB

GraphiPy: Universal Social Data Extractor

License: MIT License

Python 100.00%
social-network graph graph-algorithms graph-database graph-visualization api-wrapper facebook-api twitter-api reddit-api linkedin-api pinterest-api tumblr-api youtube-api

graphipy's Introduction

GraphiPy

A Universal Social Data Extractor

PyPI version Downloads Binder

GraphiPy simplifies the extraction of data from different social media websites. Instead of having to study the different APIs of each website, just provide the API keys and use GraphiPy!

Currently, GraphiPy provides support to 7 different websites:

Installation

GraphiPy is uploaded on PyPI and can be found here.

To install GraphiPy, run pip install GraphiPy

Please note that GraphiPy does not support Python 2 and only works on Python 3.

Video Demonstration

GraphiPy Video

Data Strcuture

GraphiPy acts like a Graph in which all the different information are stored as nodes and connections between different nodes will be stored as edges.

Currently, we have 3 graph types:

All graph types are based on a class called BaseGraph

  • Dictionary Graph To provide easy access, the type of the nodes and edges are stored as keys while the rows of data are stored as values. The rows of data is also a dictionary, with the _id of the nodes and edges as keys (to avoid duplicate data) and the values would be the node and edge objects.

  • Pandas Graph Similar to the Dictionary Graph, the type of nodes and edges are stored as keys and the dataframes are stored as values. Since inserting rows one by one into the dataframe takes polynomial time, the implementation uses the help of Python's dictionary. After a certain number of elements are inside the dictionaries, all of them are converted into dataframes and appended into the existing dataframes.

  • Neo4j Graph GraphiPy directly connects and inserts to your Neo4j database. In order to avoid duplicate data, MERGE is used instead of CREATE. Thus, whenever an existing node _id is inserted, its attributes are updated instead of inserting a completely new node.

For more information on how to use GraphiPy, please see one of the notebooks:

GraphiPy can also export data as CSV files and visualize the graphs using NetworkX. It is also possible to convert from one graph type to another (e.g. from Pandas to Neo4j and vice versa). For more information, see this notebook

  • Gephi Support: Gephi is an open-source software for network visualization and analysis. It helps data analysts to intuitively reveal patterns and trends, highlight outliers and tells stories with their data. The csv files exported from Graphify can be directly imported to Gephi. The below figure shows data visualization (via Gephi) of 20 youtube videos with keyword "dota2" extracted via GraphiPy Data of 20 youtube videos with keyword "dota2"

Folder Structure

.
├── demo
|   ├── DataExportDemo.ipynb
|   ├── FacebookDemo.ipynb
|   ├── LinkedinDemo.ipynb
|   ├── PinterestDemo.ipynb
|   ├── RedditDemo.ipynb
|   ├── TumblrDemo.ipynb
|   ├── TwitterDemo.ipynb
|   └── YoutubeDemo.ipynb
├── graphipy
|   ├── api
|   |   ├── _init_.py
|   |   ├── facebook_api.py	
|   |   ├── linkedin_api.py	
|   |   ├── pinterest_api.py
|   |   ├── reddit_api.py	
|   |   ├── tumblr_api.py	
|   |   ├── twitter_api.py	
|   |   └── youtube_api.py	
|   ├── graph
|   |   ├── _init_.py
|   |   ├── graph_base.py
|   |   ├── graph_dict.py
|   |   ├── graph_neo4j.py
|   |   └── graph_pandas.py
|   ├── _init_.py
|   ├── exportnx.py
|   └── graphipy.py
├── .gitignore 
├── README.md
└── requirements.txt
Folder/Filename Description
demo Jupyter notebooks explaining how to use the library in detail
graphipy The major directory of the library containing classes for all social media platforms, graph data structure and exporting functionalities
graphipy/api Class definitions for all social media platforms, including fetch functions and customized nodes and edges
graphipy/graph Definitions of the graph data structure implemented with dictionary, Pandas and Neo4J
requirements.txt All dependencies

graphipy's People

Contributors

chaokanw avatar peijialu avatar shobeir avatar stanshi123 avatar wtjandra96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

graphipy's Issues

ISsue in Pinterest demo

I am getting an error when using the wrapper for Pinterest -


TypeError Traceback (most recent call last)
in ()
1 # You can use username to search for a single user
2 username = "Maanshi"
----> 3 single_user_graph = pinterest.fetch_pinterest_user_by_username(graphipy.create_graph(), username)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\graphipy\api\pinterest_api.py in fetch_pinterest_user_by_username(self, graph, username)
48 def fetch_pinterest_user_by_username(self, graph, username):
49 result = self.get_single_user(username)
---> 50 user = PinterestUser(result["data"])
51 graph.create_node(user)
52 return graph

~\AppData\Local\Continuum\anaconda3\lib\site-packages\graphipy\api\pinterest_api.py in init(self, result)
253 class PinterestUser(Node):
254 def init(self, result):
--> 255 label = result["first_name"] + " " + result["last_name"]
256 Node.init(self, result["id"], label, "user")
257 self.username = result["username"]

TypeError: 'NoneType' object is not subscriptable

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.