#!/usr/bin/env python3 """ Practical Reddit RSS Feed Generator for Canadian Repair Keywords This script generates manageable, high-impact search RSS feeds for Canadian subreddits by grouping related keywords into efficient search combinations. """ import urllib.parse import json from pathlib import Path class PracticalRSSGenerator: def __init__(self): self.base_search_url = "https://www.reddit.com/r/{}/search.rss?q={}&sort=new&type=link" # Smart keyword groupings for practical RSS feeds self.keyword_groups = { "power_issues": [ '"won\'t turn on"', '"dead"', '"no power"', '"not starting"', '"bricked"', '"won\'t boot"', '"boot failure"', '"power button"' ], "charging_issues": [ '"won\'t charge"', '"not charging"', '"charging port broken"', '"battery dead"', '"battery not holding charge"', '"charging issues"' ], "screen_issues": [ '"screen broken"', '"cracked screen"', '"black screen"', '"screen of death"', '"display damaged"', '"touch screen not working"' ], "water_damage": [ '"water damage"', '"spilled"', '"liquid damage"', '"got wet"', '"water damaged"', '"liquid spilled"' ], "performance_issues": [ '"slow"', '"running slow"', '"performance issues"', '"crashing"', '"freezing"', '"unresponsive"', '"overheating"' ], "connectivity_issues": [ '"won\'t connect"', '"connection issues"', '"WiFi problems"', '"bluetooth not working"', '"USB ports not working"' ], "storage_issues": [ '"hard drive failed"', '"SSD dead"', '"storage failed"', '"hard drive clicking"', '"drive not recognized"', '"data recovery"' ], "repair_services": [ '"looking for repair"', '"need repair"', '"repair shop"', '"repair service"', '"professional repair"', '"local repair"' ] } # Device categories for combination searches self.device_categories = { "apple_devices": ["iPhone", "iPad", "MacBook", "MacBook Pro", "MacBook Air"], "android_devices": ["Samsung", "Samsung Galaxy", "Galaxy", "Android"], "gaming_devices": ["PlayStation", "PS5", "PS4", "Xbox", "Nintendo Switch"], "general_devices": ["laptop", "computer", "desktop", "PC", "notebook"] } # Canadian subreddits by priority (focused on manageable list) self.subreddits = { "critical": ["toronto", "vancouver"], "high": ["calgary", "edmonton", "montreal", "ottawa"], "medium": ["hamilton", "kitchener", "winnipeg", "victoria", "halifax"] } def generate_combined_searches(self): """Generate smart combined search terms""" combined_searches = {} # For each subreddit priority level for priority, subs in self.subreddits.items(): combined_searches[priority] = {} for subreddit in subs: combined_searches[priority][subreddit] = [] # Generate device + problem combinations for device_category, devices in self.device_categories.items(): for problem_group, problems in self.keyword_groups.items(): # Create OR-combined search for this device/problem combo device_or = " OR ".join(f'"{device}"' for device in devices) problem_or = " OR ".join(problems) # Combined search search_term = f"({device_or}) AND ({problem_or})" combined_searches[priority][subreddit].append({ "name": f"{device_category.replace('_', ' ').title()} {problem_group.replace('_', ' ').title()}", "search_term": search_term, "devices": devices, "problems": problems }) # Add pure repair service searches service_or = " OR ".join(self.keyword_groups["repair_services"]) combined_searches[priority][subreddit].append({ "name": "Repair Service Requests", "search_term": service_or, "devices": [], "problems": self.keyword_groups["repair_services"] }) return combined_searches def generate_rss_urls(self, combined_searches): """Generate RSS URLs for all search combinations""" rss_feeds = {} for priority, subreddits in combined_searches.items(): rss_feeds[priority] = {} for subreddit, searches in subreddits.items(): rss_feeds[priority][subreddit] = [] for search in searches: encoded_term = urllib.parse.quote(search["search_term"]) url = self.base_search_url.format(subreddit, encoded_term) rss_feeds[priority][subreddit].append({ "name": search["name"], "search_term": search["search_term"], "url": url, "devices": search["devices"], "problems": search["problems"] }) return rss_feeds def generate_markdown_output(self): """Generate clean markdown output""" combined_searches = self.generate_combined_searches() rss_feeds = self.generate_rss_urls(combined_searches) output = [] # Header output.append("# 🎯 Practical Canadian Repair RSS Feeds") output.append("") output.append("**Strategy:** Smart keyword groupings for manageable, high-impact RSS monitoring") output.append("**Coverage:** Device + problem combinations across priority Canadian cities") output.append("**Total Feeds:** Manageable number for daily monitoring") output.append("") output.append("---") output.append("") total_feeds = 0 # Process each priority level for priority, subreddits in rss_feeds.items(): priority_title = priority.upper() output.append(f"## {priority_title} PRIORITY SUBREDDITS") output.append("") for subreddit, feeds in subreddits.items(): output.append(f"### r/{subreddit}") output.append("") total_feeds += len(feeds) for feed in feeds: output.append(f"#### {feed['name']}") output.append("") output.append(f"**Search Query:** `{feed['search_term']}`") output.append(f"**RSS URL:** {feed['url']}") output.append("") # Show what this covers if feed['devices']: output.append(f"**Devices:** {', '.join(feed['devices'][:3])}{'...' if len(feed['devices']) > 3 else ''}") if feed['problems']: output.append(f"**Problems:** {', '.join([p.strip('\"') for p in feed['problems'][:3]])}{'...' if len(feed['problems']) > 3 else ''}") output.append("") output.append("---") output.append("") output.append("") # Summary output.append("## 📊 FEED SUMMARY") output.append("") output.append(f"- **Total RSS Feeds:** {total_feeds}") output.append(f"- **Subreddits Covered:** {sum(len(subs) for subs in self.subreddits.values())}") output.append(f"- **Keyword Groups:** {len(self.keyword_groups)}") output.append(f"- **Device Categories:** {len(self.device_categories)}") output.append("") output.append("## 🚀 IMPLEMENTATION STRATEGY") output.append("") output.append("### Phase 1: Critical Cities (Start Here)") output.append("- Toronto + Vancouver (2 subreddits × 5 feeds each = 10 feeds)") output.append("- Focus on Apple devices, general repairs, and power issues") output.append("") output.append("### Phase 2: High Priority Expansion") output.append("- Add Calgary, Edmonton, Montreal, Ottawa") output.append("- Total: 6 subreddits × 5 feeds = 30 feeds") output.append("") output.append("### Phase 3: Medium Priority") output.append("- Add Hamilton, Kitchener, Winnipeg, Victoria, Halifax") output.append("- Total: 11 subreddits × 5 feeds = 55 feeds") output.append("") output.append("## 💡 PRO TIPS") output.append("") output.append("- **Start with 5-10 feeds** from Toronto to test your process") output.append("- **Use RSS reader folders** organized by city/problem type") output.append("- **Monitor daily** and engage with 1-2 relevant conversations") output.append("- **Track conversion rates** to identify most valuable feeds") output.append("- **Archive old posts** weekly to keep feeds manageable") return "\n".join(output) def save_to_file(self, filename="practical_rss_feeds.md"): """Save the markdown output to a file""" output = self.generate_markdown_output() with open(filename, 'w', encoding='utf-8') as f: f.write(output) print(f"✅ Generated {filename} with {self.count_feeds()} practical RSS feeds") print("📊 Ready for Canadian repair lead monitoring!") def count_feeds(self): """Count total feeds that will be generated""" combined_searches = self.generate_combined_searches() total = 0 for priority, subreddits in combined_searches.items(): for subreddit, searches in subreddits.items(): total += len(searches) return total def main(): generator = PracticalRSSGenerator() generator.save_to_file() if __name__ == "__main__": main()