AI-powered news bot for X.com (Twitter) automation with research and writing capabilities.
Project description
AI-Journo ๐ค๐ฐ
AI-Journo is an intelligent, autonomous journalism system that discovers, verifies, summarizes, and posts breaking news on X.com (formerly Twitter). Built with a multi-agent architecture using Selenium automation and powered by Google's Gemini 2.0 Flash model, it specializes in covering geopolitics, conflicts, wars, and other high-impact global events.
โจ Features
๐ Autonomous News Discovery
- Monitors trusted news sources (BBC, Reuters, CNN, Al Jazeera, Dawn)
- Scrapes homepages and search results for breaking news
- Tracks trending topics from verified X.com accounts
๐ก๏ธ Intelligent Verification
- Multi-source cross-referencing for fact-checking
- AI-powered content summarization with Gemini 2.0 Flash
- Filters out speculation and unverified information
๐ Professional Content Creation
- Generates concise, neutral summaries optimized for social media
- Maintains journalistic standards and objectivity
- Supports image attachments and media handling
๐ Automated X.com Management
- Selenium-based browser automation for posting
- Cookie-based session management for persistent login
- Account engagement features (following, searching, monitoring)
๐ง Memory Management
- Tracks processed stories to avoid duplication
- Maintains context across sessions
- Persistent memory for agent coordination
๐๏ธ Architecture
AI-Journo uses a sophisticated multi-agent system with specialized roles:
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ MainAgent โ โ ResearchAgent โ โ WriterAgent โ
โ โ โ โ โ โ
โ โข Orchestrates โโโโโบโ โข News discoveryโโโโโบโ โข Content โ
โ โข Memory mgmt โ โ โข Verification โ โ creation โ
โ โข Coordination โ โ โข Source checks โ โ โข Summarization โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ XAgent โ โ Tools Suite โ
โ โ โ โ
โ โข X.com posting โ โ โข Web scraping โ
โ โข Account mgmt โ โ โข Image handlingโ
โ โข Monitoring โ โ โข API calls โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
๐ค Agent Roles
- MainAgent: Central coordinator managing workflow, memory, and agent communication
- ResearchAgent: Discovers and verifies news from trusted sources
- WriterAgent: Creates optimized social media content from research summaries
- XAgent: Handles all X.com interactions via Selenium automation
๐ Quick Start
Installation
# Install from PyPI (when published)
pip install xnewsbot
# Or install from source
git clone https://github.com/iPythonezta/AI-Journo.git
cd AI-Journo
pip install -e .
Basic Usage
from xnewsbot import AIJourno
# Initialize with your credentials
journo = AIJourno(
x_username="your_username",
x_password="your_password",
api_key="your_gemini_api_key"
)
# Run a specific task
journo.run("Find and post latest news about Middle East conflicts")
# Monitor breaking news
journo.run("Monitor trending topics and post updates on significant developments")
Environment Setup
- Get Gemini API Key: Visit Google AI Studio to get your API key
- Install Chrome: Required for Selenium automation
- Create directories: The system will create
images/andcookies/folders automatically
๐ Requirements
- Python 3.8+
- Google Chrome (for Selenium automation)
- Gemini API Key (for AI processing)
Dependencies
smolagents>=0.3.0
litellm>=1.0.0
selenium>=4.0.0
requests>=2.25.0
beautifulsoup4>=4.9.0
undetected_chromedriver>=3.4.0
pillow>=8.0.0
urllib3>=1.26.0
๐ง Configuration
Supported News Sources
- BBC News (
https://www.bbc.com/) - Dawn (
https://www.dawn.com/) - Al Jazeera (
https://www.aljazeera.com/) - Reuters, CNN (via web scraping)
X.com Account Monitoring
The system can monitor trusted accounts for breaking news:
@warmonitors@sentdefender@jacksonhinkle- Custom account lists
๐ ๏ธ Advanced Usage
Custom Research Tasks
# Research specific topics
journo.run("Research and verify reports about recent developments in Ukraine")
# Monitor specific regions
journo.run("Find breaking news from Middle East sources and create summary post")
Image Handling
# The system automatically handles images
# Images are stored in xnewsbot/images/ directory
# Supports JPEG, PNG formats
# Automatic image attachment to posts
Memory Management
# Memory is automatically managed
# Prevents duplicate story processing
# Maintains context across sessions
# Can be cleared manually if needed
๐ Project Structure
AI-Journo/
โโโ xnewsbot/
โ โโโ __init__.py # Package initialization
โ โโโ ai_journo.py # Main AIJourno class
โ โโโ agents.py # Multi-agent system setup
โ โโโ tools.py # Specialized tools and utilities
โ โโโ twitterbot.py # Selenium X.com automation
โ โโโ prompts/ # AI agent prompts
โ โ โโโ main_prompt.txt
โ โ โโโ research_agent_prompt.txt
โ โ โโโ writer_prompt.txt
โ โ โโโ x_agent_prompt.txt
โ โโโ images/ # Media storage
โโโ requirements.txt # Dependencies
โโโ setup.py # Package configuration
โโโ README.md # This file
๐ Security & Privacy
- Local Processing: All automation runs locally on your machine
- Credential Management: Secure session handling with cookie storage
- Rate Limiting: Built-in delays to respect platform limits
- No Data Collection: No user data is transmitted to external services (except API calls)
โ ๏ธ Important Notes
Rate Limiting
The system includes built-in rate limiting to respect:
- X.com API limits and platform policies
- News source scraping guidelines
- Gemini API quotas (5 requests per minute)
Responsible Use
- Verify Information: Always cross-check important news before posting
- Respect Sources: Follow news website terms of service
- Platform Compliance: Ensure X.com account follows platform guidelines
- Ethical Journalism: Maintain objectivity and factual accuracy
Legal Compliance
- Use only for legitimate journalism and news sharing
- Respect copyright and fair use policies
- Follow local laws regarding automated social media activity
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
For support, questions, or feature requests:
- Issues: GitHub Issues
- Discussions: GitHub Discussions
โก Built for the future of automated journalism - AI-Journo helps you stay informed and share breaking news responsibly.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xnewsbot-0.6.0.tar.gz.
File metadata
- Download URL: xnewsbot-0.6.0.tar.gz
- Upload date:
- Size: 111.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4113146e80da9bbc5bdb9edd1d17d3e1d1a1483eb0d05873d8f006b8f4e6c2cb
|
|
| MD5 |
127c333a65f6754678ee26d1975367e1
|
|
| BLAKE2b-256 |
00b911b6f91afc680afe692de120f697832787ff20a429fb8677e539a9c59748
|
File details
Details for the file xnewsbot-0.6.0-py3-none-any.whl.
File metadata
- Download URL: xnewsbot-0.6.0-py3-none-any.whl
- Upload date:
- Size: 108.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39e1a346675632358cf1c808083c24565a41a14c38396da60ada58cd83744495
|
|
| MD5 |
611d0b65978bf7e7167ddbcedd211933
|
|
| BLAKE2b-256 |
71dd97dd1a06a80c9f0e539e627bde6955f721f64644127e8b61009208762df8
|