#!/usr/bin/env python3 """ Reddit RSS Feed Generator for Canadian Repair Keywords This script generates comprehensive search RSS feeds for all Canadian subreddits using exhaustive repair keyword combinations to ensure no opportunities are missed. """ import urllib.parse import json from pathlib import Path class RedditRSSGenerator: def __init__(self): self.base_search_url = "https://www.reddit.com/r/{}/search.rss?q={}&sort=new&type=link" # Comprehensive repair keywords organized by category self.keywords = { "device_types": [ "iPhone", "iPad", "MacBook", "MacBook Pro", "MacBook Air", "laptop", "computer", "desktop", "PC", "notebook", "iPhone 12", "iPhone 13", "iPhone 14", "iPhone 15", "iPad Pro", "iPad Air", "iPad mini", "Samsung", "Samsung Galaxy", "Galaxy", "Android", "PlayStation", "PS5", "PS4", "Xbox", "Nintendo Switch", "gaming console", "console", "game console" ], "problems": [ "won't turn on", "not turning on", "dead", "no power", "won't start", "not starting", "bricked", "broken", "won't boot", "not booting", "boot failure", "black screen", "screen of death", "blank screen", "blue screen", "BSOD", "kernel panic", "won't charge", "not charging", "charging port broken", "battery dead", "battery not holding charge", "overheating", "getting hot", "thermal issues", "slow", "running slow", "performance issues", "crashing", "freezing", "unresponsive", "won't connect", "connection issues", "WiFi problems", "water damage", "spilled", "liquid damage", "got wet", "screen broken", "cracked screen", "display damaged", "touch screen not working", "touch issues", "keyboard not working", "keys stuck", "hard drive failed", "SSD dead", "storage failed", "hard drive clicking", "drive not recognized", "fan not working", "loud fan", "noisy", "USB ports not working", "ports broken", "HDMI not working", "display port broken", "speakers not working", "audio issues", "no sound", "microphone broken", "mic not working", "camera not working", "webcam broken", "bluetooth not working", "wireless issues" ], "services": [ "repair", "fix", "repair shop", "repair service", "looking for repair", "need repair", "repair help", "professional repair", "repair technician", "repair quote", "repair estimate", "repair cost", "repair recommendation", "best repair shop", "local repair", "repair near me", "data recovery", "recover data", "recover files", "diagnostics", "diagnostic", "troubleshooting", "microsolder", "component level repair", "board repair", "logic board repair", "motherboard repair", "screen replacement", "display replacement", "battery replacement", "keyboard replacement", "charging port repair", "USB port repair", "hard drive replacement", "SSD replacement", "RAM upgrade", "memory upgrade", "storage upgrade" ] } # Canadian subreddits by priority self.subreddits = { "critical": [ "toronto", "vancouver" ], "high": [ "calgary", "edmonton", "montreal", "ottawa" ], "medium": [ "hamilton", "kitchener", "londonontario", "winnipeg", "victoria", "quebeccity", "halifax" ], "low": [ "saskatoon", "regina", "saskatchewan", "alberta", "britishcolumbia", "ontario", "quebec", "manitoba", "newbrunswick", "novascotia", "newfoundland" ] } def generate_search_terms(self): """Generate comprehensive search term combinations""" search_terms = [] # Device + Problem combinations for device in self.keywords["device_types"]: for problem in self.keywords["problems"]: # Exact phrase matching for precision term = f'"{device}" "{problem}"' search_terms.append(term) # OR combinations for broader matching term_or = f'{device} {problem}' search_terms.append(term_or) # Problem + Service combinations for problem in self.keywords["problems"]: for service in self.keywords["services"]: term = f'"{problem}" "{service}"' search_terms.append(term) term_or = f'{problem} {service}' search_terms.append(term_or) # Device + Service combinations for device in self.keywords["device_types"]: for service in self.keywords["services"]: term = f'"{device}" "{service}"' search_terms.append(term) term_or = f'{device} {service}' search_terms.append(term_or) # Pure service requests for service in self.keywords["services"]: search_terms.append(f'"{service}"') # Pure problem statements for problem in self.keywords["problems"]: search_terms.append(f'"{problem}"') # Remove duplicates and sort search_terms = list(set(search_terms)) search_terms.sort() return search_terms def generate_rss_urls(self, subreddit, search_terms): """Generate RSS URLs for a subreddit with all search terms""" urls = [] for term in search_terms: # URL encode the search term encoded_term = urllib.parse.quote(term) url = self.base_search_url.format(subreddit, encoded_term) urls.append({ "subreddit": subreddit, "search_term": term, "url": url }) return urls def generate_markdown_output(self): """Generate clean markdown output with all RSS feeds""" output = [] # Header output.append("# 🔍 Comprehensive Canadian Repair RSS Feeds") output.append("") output.append("**Generated:** Comprehensive keyword coverage across all Canadian subreddits") output.append("**Strategy:** Zero missed keyword combinations for maximum repair lead capture") output.append("") output.append("---") output.append("") # Generate search terms search_terms = self.generate_search_terms() # Process each priority level for priority, subs in self.subreddits.items(): priority_title = priority.upper() output.append(f"## {priority_title} PRIORITY SUBREDDITS") output.append("") for subreddit in subs: output.append(f"### r/{subreddit}") output.append("") # Generate RSS URLs for this subreddit rss_urls = self.generate_rss_urls(subreddit, search_terms) for item in rss_urls[:20]: # Limit to first 20 per subreddit for readability output.append(f"**Search:** `{item['search_term']}`") output.append(f"**RSS URL:** {item['url']}") output.append("") if len(rss_urls) > 20: output.append(f"*... and {len(rss_urls) - 20} more search combinations*") output.append("") output.append("---") output.append("") # Summary section output.append("## 📊 COVERAGE SUMMARY") output.append("") output.append(f"- **Total Subreddits:** {sum(len(subs) for subs in self.subreddits.values())}") output.append(f"- **Search Terms:** {len(search_terms)}") output.append(f"- **Total RSS Feeds:** {sum(len(subs) for subs in self.subreddits.values()) * len(search_terms)}") output.append("") output.append("## 🎯 HOW TO USE") output.append("") output.append("1. **Start with CRITICAL priority** subreddits (Toronto, Vancouver)") output.append("2. **Subscribe to RSS feeds** in your RSS reader") output.append("3. **Monitor daily** for repair-related posts") output.append("4. **Engage in conversations** where users seek local repair services") output.append("5. **Expand gradually** to HIGH and MEDIUM priority subreddits") output.append("") output.append("## 🔧 RSS READER SETUP") output.append("") output.append("- Use Feedly, Inoreader, or similar RSS reader") output.append("- Create folders by city/priority level") output.append("- Set up notifications for new posts") output.append("- Archive processed feeds regularly") return "\n".join(output) def save_to_file(self, filename="comprehensive_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 comprehensive RSS feeds") print(f"📊 Total feeds: {sum(len(subs) for subs in self.subreddits.values()) * len(self.generate_search_terms())}") def main(): generator = RedditRSSGenerator() generator.save_to_file() if __name__ == "__main__": main()