#!/usr/bin/env python3 """ Quick script to check all RSS feeds status """ import asyncio from rss_manager import RSSFeedManager from bot_config import CATEGORY_FEEDS async def check_all_feeds(): totals = {} offline_by_category = {} for category, feeds_file in CATEGORY_FEEDS.items(): print("\n" + "=" * 80) print(f"CHECKING {category.upper()} FEEDS") print("=" * 80) async with RSSFeedManager(feeds_file=feeds_file, feed_type=category) as manager: status_data = await manager.check_feed_status() total = 0 online = 0 offline = [] for status_category, feeds in status_data.items(): print(f"\nšŸ“” {status_category.replace('_', ' ').title()}:") for feed_name, feed_info in feeds.items(): total += 1 status_icon = feed_info['status'] entries = feed_info['entries'] if 'āœ…' in status_icon: online += 1 print(f" āœ… {feed_name}: {entries} articles") else: offline.append(feed_name) error = feed_info.get('error', 'Unknown error') print(f" āŒ {feed_name}: {error[:80]}") totals[category] = {"total": total, "online": online, "offline": len(offline)} offline_by_category[category] = offline print("\n" + "=" * 80) print("SUMMARY") print("=" * 80) grand_total = 0 grand_online = 0 grand_offline = 0 for category in CATEGORY_FEEDS: stats = totals.get(category, {"total": 0, "online": 0, "offline": 0}) grand_total += stats["total"] grand_online += stats["online"] grand_offline += stats["offline"] print(f"\n• {category}: total={stats['total']} online={stats['online']} offline={stats['offline']}") print(f"\nšŸŒ OVERALL:") print(f" Total: {grand_total}") print(f" Online: {grand_online} āœ…") print(f" Offline: {grand_offline} āŒ") if grand_offline: print(f"\nāš ļø OFFLINE FEEDS:") for category, feeds in offline_by_category.items(): for feed in feeds: print(f" [{category}] {feed}") print("\n" + "=" * 80) if __name__ == "__main__": asyncio.run(check_all_feeds())