A Python pipeline for collecting and preprocessing news articles and tweets related to misinformation detection.
- Data Collection: Collect news articles from NewsAPI and tweets from Twitter API
- Text Preprocessing: Clean and normalize text data with NLP techniques
- MongoDB Storage: Store collected data in MongoDB
- Error Handling: Robust error handling and logging
- Duplicate Prevention: Avoid inserting duplicate articles/tweets
-
Install dependencies:
python setup.py
-
Configure API keys in
config/config.yaml:- Get NewsAPI key from: https://newsapi.org/
- Get Twitter Bearer Token from: https://developer.twitter.com/
-
Start MongoDB (if running locally):
mongod
-
Run the pipeline:
python main.py
├── config/
│ └── config.yaml # API keys and configuration
├── storage/
│ └── db.py # MongoDB connection
├── ingestion/
│ ├── news_ingest.py # NewsAPI data collection
│ └── twitter_ingest.py # Twitter data collection
├── preprocessing/
│ └── clean_text.py # Text cleaning utilities
├── tests/
│ └── test_ingestion.py # Basic tests
├── main.py # Main pipeline script
├── setup.py # Setup script
└── requirements.txt # Dependencies
The pipeline will:
- Collect recent tweets and news articles about misinformation
- Clean and preprocess the text data
- Store everything in MongoDB with duplicate prevention
- Provide progress updates and error handling
- Python 3.7+
- MongoDB
- Internet connection for API calls
- Valid API keys for NewsAPI and Twitter