63f0ac74bc
Category labels, feed-file mappings, and emoji were copy-pasted across threat_intel_bot.py, check_feeds.py, and validation/run_validation.py, which is how the ransomware category split almost missed one of them. check_feeds.py now imports from bot_config.py instead of keeping its own copy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
72 lines
2.3 KiB
Python
72 lines
2.3 KiB
Python
#!/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())
|