# AI-Powered RSS News Aggregator
A modern, feature-rich RSS feed aggregator with AI-powered content transformation using Google Gemini API. Transform news articles into magazine-style content in multiple Indian languages.
## 🌟 Features
### Core Functionality
- **RSS Feed Aggregation**: Parse multiple RSS feeds from Google News and custom sources
- **Real-time Updates**: Auto-refresh feeds at configurable intervals
- **Category Management**: Organize feeds by Technology, Business, Sports, Entertainment, Health, etc.
- **Smart Filtering**: Search and filter articles by category, keywords, and date
- **Duplicate Detection**: Automatically prevents duplicate articles
### AI-Powered Content Transformation
- **Google Gemini Integration**: Rewrite articles using Gemini 2.0 Flash
- **Multi-Language Support**: Transform content into 12 Indian languages + English
- Tamil (தமிழ்)
- Hindi (हिन्दी)
- Telugu (తెలుగు)
- Marathi (मराठी)
- Bengali (বাংলা)
- Gujarati (ગુજરાતી)
- Kannada (ಕನ್ನಡ)
- Malayalam (മലയാളം)
- Punjabi (ਪੰਜਾਬੀ)
- Odia (ଓଡ଼ିଆ)
- Assamese (অসমীয়া)
- English
- **Magazine-Style Rewriting**: Convert news into engaging 250-word articles
- **SEO-Optimized Headlines**: Generate compelling, attention-grabbing titles
- **Trending Hashtags**: Automatically add 5 relevant hashtags per article
### Technical Features
- **No Database Required**: File-based JSON storage
- **Responsive Design**: Bootstrap 5 with modern UI/UX
- **AJAX Operations**: No page reloads for smooth user experience
- **Error Handling**: Graceful fallbacks and retry logic
- **Performance Optimized**: Caching and efficient data processing
## 📋 Prerequisites
- PHP 8.1 or higher
- cURL extension enabled
- SimpleXML extension enabled
- JSON extension enabled
- Write permissions for data directory
- Google Gemini API key (free tier available)
## 🚀 Installation
### Step 1: Upload Files
Upload all files to your web server:
```
/your-website/
├── index.php (Main application)
├── api.php (Backend API)
├── app.js (Frontend JavaScript)
└── data/ (Auto-created for storage)
```
### Step 2: Set Permissions
```bash
chmod 755 /path/to/your-website
chmod 777 /path/to/your-website/data
```
### Step 3: Get Gemini API Key
1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Sign in with your Google account
3. Click "Create API Key"
4. Copy your API key
### Step 4: Configure Application
1. Open the application in your browser
2. Click the **Settings** button
3. Paste your Gemini API key
4. Set auto-refresh interval (default: 300 seconds)
5. Click **Save Settings**
## 📖 Usage Guide
### Adding RSS Feeds
#### Method 1: Google News Categories
1. Click **Add Feed** button
2. Select a Google News category:
- World News
- National News
- Business
- Technology
- Entertainment
- Sports
- Science
- Health
3. Choose a category for organization
4. Click **Add Feed**
#### Method 2: Custom RSS Feed
1. Click **Add Feed** button
2. Leave Google News category empty
3. Enter custom RSS feed URL
4. Choose a category
5. Click **Add Feed**
**Popular RSS Feed Sources:**
- `https://feeds.bbci.co.uk/news/rss.xml` - BBC News
- `https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml` - NY Times
- `https://feeds.reuters.com/reuters/topNews` - Reuters
### Processing Articles with AI
1. Browse articles in the main grid
2. Find articles with **AI Rewrite** button (unprocessed)
3. Select your desired language from the dropdown
4. Click **AI Rewrite** on any article
5. Wait for processing (takes 5-10 seconds)
6. Article will refresh with:
- Rewritten headline
- 250-word magazine-style content
- 5 trending hashtags
- Original source link preserved
### Filtering and Searching
**By Category:**
- Click category tabs at the top (All, Technology, Business, etc.)
- View only articles from that category
**By Search:**
- Type keywords in the search box
- Searches both titles and content
- Updates results in real-time
### Auto-Refresh
Articles automatically refresh based on your configured interval:
- Default: Every 5 minutes (300 seconds)
- Customizable in Settings
- Manual refresh: Click **Refresh** button
## 🔧 Advanced Configuration
### Adjusting Article Fetch Limits
Edit `api.php`, find this line:
```php
if ($newCount >= 20) {
break;
}
```
Change `20` to your desired limit per feed refresh.
### Modifying Content Length
Edit the Gemini prompt in `api.php`:
```php
$prompt = "... Rewrite the content to EXACTLY 250 words ...";
```
Change `250` to your desired word count.
### Adding More Categories
Edit `index.php`, add buttons in the category tabs section:
```html
```
### Custom Language Support
Add to `app.js` in the language select:
```javascript
```
## 📊 Data Structure
### Feeds Storage (`data/feeds.json`)
```json
{
"feeds": [
{
"id": "feed_abc123",
"url": "https://news.google.com/rss/...",
"category": "technology",
"last_updated": "2025-10-06 10:30:00",
"added_date": "2025-10-06 09:00:00"
}
]
}
```
### Articles Storage (`data/articles.json`)
```json
{
"articles": [
{
"id": "article_xyz789",
"feed_id": "feed_abc123",
"original_title": "Original Article Title",
"original_content": "Original content...",
"rewritten_title": "AI-Generated Headline",
"rewritten_content": "Rewritten 250-word content...",
"hashtags": ["#tech", "#ai", "#news", "#trending", "#innovation"],
"source_url": "https://example.com/article",
"source": "example.com",
"published_date": "2025-10-06 10:00:00",
"category": "technology",
"processed": true,
"processed_date": "2025-10-06 10:15:00",
"language": "ta",
"added_date": "2025-10-06 10:00:00"
}
]
}
```
## 🛠️ Troubleshooting
### Issue: "Gemini API key not configured"
**Solution:** Add your API key in Settings. Get it from [Google AI Studio](https://makersuite.google.com/app/apikey).
### Issue: No articles loading
**Solutions:**
1. Check if feeds are added (click Add Feed)
2. Click Refresh button to fetch articles
3. Verify RSS feed URL is valid
4. Check browser console for errors
### Issue: AI Rewrite button not working
**Solutions:**
1. Verify Gemini API key is correct
2. Check API key has remaining quota
3. Open browser console to see error messages
4. Verify internet connection
### Issue: Permission denied errors
**Solution:**
```bash
chmod 777 /path/to/data/
```
### Issue: Articles not auto-refreshing
**Solutions:**
1. Keep the browser tab active
2. Check auto-refresh interval in Settings
3. Verify JavaScript is not blocked
## 🎨 Customization
### Changing Color Scheme
Edit `index.php` CSS variables:
```css
:root {
--primary-color: #2563eb; /* Change to your color */
--secondary-color: #7c3aed; /* Change to your color */
--accent-color: #06b6d4; /* Change to your color */
}
```
### Modifying Card Layout
In `app.js`, find `displayArticles()` function and modify the HTML template.
### Custom Feed Categories
Add to Google News category options in `index.php`:
```html
```
## 📈 Performance Tips
1. **Limit Active Feeds**: Keep 5-10 active feeds for optimal performance
2. **Increase Refresh Interval**: Use longer intervals (600+ seconds) for large feeds
3. **Process Selectively**: Only rewrite articles you plan to use
4. **Regular Cleanup**: Periodically delete old articles from `data/articles.json`
5. **Enable PHP OPcache**: Improves PHP performance significantly
## 🔐 Security Recommendations
1. **Protect Data Directory**: Add `.htaccess`:
```apache
# Place in /data/.htaccess
Require all denied
```
2. **Hide API Key**: Never expose in client-side code (already handled)
3. **Input Validation**: Already implemented for URLs and data
4. **HTTPS**: Use SSL certificate for production
5. **Rate Limiting**: Consider adding if deploying publicly
## 📝 API Endpoints
- `GET api.php?action=getSettings` - Retrieve configuration
- `POST api.php?action=saveSettings` - Save configuration
- `POST api.php?action=addFeed` - Add new RSS feed
- `GET api.php?action=getArticles` - Get all articles
- `POST api.php?action=refreshFeeds` - Refresh all feeds
- `POST api.php?action=processArticle` - Process article with AI
## 🤝 Support
For issues or questions:
1. Check troubleshooting section above
2. Verify all prerequisites are met
3. Check browser console for error messages
4. Review PHP error logs
## 📄 License
This project is open-source and free to use for personal and commercial purposes.
## 🎯 Future Enhancements
- [ ] Export articles as PDF/DOCX
- [ ] Social media sharing integration
- [ ] Scheduled publishing
- [] Multi-user support
- [ ] Analytics dashboard
- [ ] Image optimization
- [ ] Email notifications
- [ ] Mobile app version
## 🏆 Credits
- **AI**: Google Gemini 2.0 Flash
- **Framework**: Bootstrap 5
- **Icons**: Font Awesome 6
- **RSS Parsing**: PHP SimpleXML
---
**Version:** 1.0.0
**Last Updated:** October 2025
**Author:** AI-Powered Development