Lab 9 Collect #Tweets into #MongoDB with #Python
Channel: LBSocial
Date: 2020-10-28

Objectives:
• Learn how to collect social media data with APIs;
• Learn how to insert data into MongoDB in Python.

Data: 
• Collect Tweets with REST and Streaming API

Steps:
1. Start the Jupyter notebook instance, write your MongoDB connection info and Twitter API keys to the config.ini file.
2. Follow this demo code (https://github.com/xbwei/Data-Mining-on-Social-Media/blob/master/MongoDB/Collect_Tweets_into_MongoDB.ipynb ) to collect tweets with the REST API and the Streaming API.
o Connect to your MongoDB database, and create a collection lab9.
o Use Streaming API to collect tweets talking about COVID19.
o Use REST API to collect tweets talking about COVID19.
3. Add a text key to the tweets’ text key.
4. View the collected tweets with pprint and pandas.
5. Make sure you have more than 1,000 tweets in total. If not, repeat step2. Please don’t delete your collection, as we will your lab10 collection next week.
6. View the collected on MongoDB Atlas

7. Publish your notebook on GitHub.


More about data mining: https://www.youtube.com/watch?v=6kvkREtmb0w&list=PLHutrxqbP1ByGhrCv0tZADlIQxwHEbhdL