A fully autonomous news editor that scrapes articles from trusted sources, translates them to Telugu, and publishes them to a CMS - all in a single browser-based process.
# Install Python packages
pip install -r requirements.txt
# Install Playwright browser (use python -m playwright, not just playwright)
python -m playwright install chromiumCreate a .env file in the project root:
# CMS Credentials (REQUIRED)
CMS_URL=https://your-cms-url.com
CMS_EMAIL=your-email@example.com
CMS_PASSWORD=your-password
CMS_ROLE=State Sub Editor
# OpenAI API Key (REQUIRED)
OPENAI_API_KEY=sk-your-openai-api-key-here
# Browser Settings (OPTIONAL)
HEADLESS=false
SLOW_MO=400
USER_DATA_DIR=.playwright
SCREENSHOTS_DIR=artifacts/screenshots
DOWNLOADS_DIR=artifacts/downloadsImportant:
- Copy
env.exampleto.envand fill in your actual values CMS_URL,CMS_EMAIL,CMS_PASSWORD, andOPENAI_API_KEYare REQUIREDHEADLESS=falsemeans browser will be visible (recommended for first run)SLOW_MO=400adds 400ms delay between actions (makes it easier to watch)
python main.py- Browser Opens (visible, headful mode)
- CMS Login - Automatically logs into your CMS
- Article Scraping - Tries to scrape from BBC/Al Jazeera/NBC (in order)
- Summarization - Generates English summary (300-360 chars)
- Telugu Translation - Translates to Telugu (300-360 chars)
- Category Selection - Decides category using keywords
- CMS Publishing - Fills form and publishes article
- Success - Stops when one article is published
The system will try up to 5 articles until one is successfully published.
Key Principle: The Browser Agent is the ONLY decision maker. No external schedulers, databases, or API servers.
- main.py: Controller loop (tries up to 5 articles until one is published)
- agent/browser_agent.py: Playwright browser management
- agent/scraper.py: News article scraping from BBC/Al Jazeera/NBC
- agent/summarizer.py: English summarization (300-360 chars)
- agent/telugu_writer.py: Telugu translation with fallbacks
- agent/category_decider.py: Simple keyword-based category selection
- agent/cms_publisher.py: CMS login, form filling, and publishing
- No Database: All in-memory, no persistence
- No Scheduler: Single run, publishes one article
- No Hard Blockers: Quality checks warn but never block
- Visible Browser: See exactly what's happening
- Automatic Fallbacks: Telugu failures → English, publish failures → try next article
- Spiritual: temple, god, puja, astrology
- Sports: cricket, match, player, ipl
- Entertainment: actor, film, cinema, movie
- Health: health, diet, disease, medical
- International: Only if clearly foreign (USA, China, etc.)
- National: Default for everything else
Matches TV9/Eenadu/Sakshi digital news style:
- Natural Telugu (not literal translation)
- Newsroom vocabulary
- Short, punchy sentences
- 300-360 characters for summary
- Make sure you created
.envfile (notenv.example) - Check that
OPENAI_API_KEY=sk-...is in.env
- Make sure
CMS_URL,CMS_EMAIL, andCMS_PASSWORDare in.env
- Make sure Playwright is installed:
playwright install chromium - Check that
HEADLESS=falsein.env
- Check internet connection
- News sources (BBC/Al Jazeera/NBC) might be blocked in your region
- Try running again (different articles may be available)
- Verify CMS credentials in
.env - Check that
CMS_ROLEmatches exactly (case-sensitive) - Make sure CMS URL is correct
- Network issues
- News source website structure changed
- Try running again (will try different sources)
Check artifacts/logs/automation.log for detailed logs of what happened.
Screenshots are saved to artifacts/screenshots/ if errors occur.