Skip to main content

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.

Python 3.8+ License: MIT

โœจ 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

  1. Get Gemini API Key: Visit Google AI Studio to get your API key
  2. Install Chrome: Required for Selenium automation
  3. Create directories: The system will create images/ and cookies/ 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:


โšก 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

xnewsbot-0.6.0.tar.gz (111.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xnewsbot-0.6.0-py3-none-any.whl (108.6 kB view details)

Uploaded Python 3

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

Hashes for xnewsbot-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4113146e80da9bbc5bdb9edd1d17d3e1d1a1483eb0d05873d8f006b8f4e6c2cb
MD5 127c333a65f6754678ee26d1975367e1
BLAKE2b-256 00b911b6f91afc680afe692de120f697832787ff20a429fb8677e539a9c59748

See more details on using hashes here.

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

Hashes for xnewsbot-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39e1a346675632358cf1c808083c24565a41a14c38396da60ada58cd83744495
MD5 611d0b65978bf7e7167ddbcedd211933
BLAKE2b-256 71dd97dd1a06a80c9f0e539e627bde6955f721f64644127e8b61009208762df8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page