If you are looking to work on a data science task where you want to analyze your social media data then you must be worried about how to collect data from your social media accounts. So, in this article, I will take you through how to collect data from social media.
How To Collect Data From Social Media?
Here are some of the popular social media accounts which are used that are used to analyze your data for any data science task such as Sentiment Analysis:
Now let’s have a look at each of these social media platforms to learn how to collect data from them.
The data collected from Facebook can be used for the task of sentiment analysis as it is a free speech platform and everyone is allowed to share their opinions on any topic. Here are the steps that you need to follow to collect data from your Facebook account:
- Go to settings & privacy
- Then go to settings
- From the left click on Your Facebook Information
- Click on view at Download your information
- Then only select posts and click on create file.
The data will be downloaded and you can explore your data. Just for saving your time, I will recommend you to find the “your_posts_1.json” file from the dataset downloaded from your Facebook account if you want to work on the task of sentiment analysis. Here is an example of how you can use your data downloaded from your Facebook account.
Twitter is an amazing data source for working on any data science task. But collecting data from Twitter is not as easy as collecting data from Facebook as to get data from Twitter you must have the Twitter API. So here are the steps you need to follow to get data from Twitter:
- Go to https://developer.twitter.com/en/apps.
- Sign in to your Twitter account.
- Then click on create new app.
- Then enter the name of your project, a good description.
- Then agree to the terms and conditions and then click on create.
- You will get to see your consumer key and the consumer secret note it somewhere as you will need it in future (all the steps above were followed to get your consumer key and consumer secret).
- Then you have to install a Python library “twython”, which can be easily installed using the pip command; pip install twython.
Then you have to use your consumer key and consumer secret as shown below:
The data collected from WhatsApp can be used for analyzing chats between two people or a group chat also. You can analyze WhatsApp chats for tasks such as sentiment analysis, topic modelling etc. Now below are the steps that you have to follow to collect data from WhatsApp:
- Open any chat or any group chat
- Click on the 3 dots above
- Select more and then select export chat
- You will get options whether you want to include media or not so it is preferable to exclude media.
The Instagram data can be used to analyze which type of posts get a higher reach on Instagram which is very useful for a company that wants to sell services on a social media platform. Here are the steps that you need to follow to get your data from Instagram:
- Go to your profile and click on settings
- Then go to privacy and security
- In the end, you will see the second last option as “Data Download”
- Below that option, you will see “Request Download”, click on it and follow the steps.
So in this article, I introduced you to how you can collect your data from social media accounts such as Facebook, Instagram, Twitter, and WhatsApp. I hope you liked this article on how to collect data from social media for data science tasks. Feel free to ask your valuable questions in the comments section below.