A Python application that collects AI-related news from Twitter using Twitter API v2.
- Fetches AI-related tweets using configurable search criteria
- Filters for verified accounts and tweets with links
- Supports customizable result limits
- Built-in logging and error handling
- Environment-based configuration
- Python 3.8+
- Twitter API Bearer Token
- pip package manager
- Clone the repository:
git clone https://github.com/rajeshkanaka/AI-News-Collector.git
cd AI-News-Collector
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the project root:
TWITTER_BEARER_TOKEN=your_twitter_bearer_token
get token https://developer.twitter.com/en/portal/dashboard
Run the main script:
python grok_writer.py
NewLetter/
├── grok_writer.py # Main collector implementation
├── twitter_api_client.py # Twitter API client
├── requirements.txt # Project dependencies
├── .env # Environment variables (not in repo)
└── README.md # Documentation
The application uses the following environment variables:
TWITTER_BEARER_TOKEN
: Twitter API Bearer Token for authentication
Default search parameters:
- Language: English
- Tweet type: Original tweets (no retweets)
- Account status: Verified accounts
- Content requirements: Must contain links
- Topics: AI, Machine Learning, Deep Learning
- Logs errors using Python's logging module
- Graceful handling of API failures
- Environment variable validation
- Fork the repository
- Create a feature branch
- Commit changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.