RSS Telegram Bot
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Quick script to check all RSS feeds status
|
||||
"""
|
||||
import asyncio
|
||||
from rss_manager import RSSFeedManager
|
||||
|
||||
CATEGORY_FEEDS = {
|
||||
"news": "feeds/news_feeds.json",
|
||||
"malware": "feeds/malware_feeds.json",
|
||||
"threat_intel": "feeds/threat_intel_feeds.json",
|
||||
"osint": "feeds/osint_feeds.json",
|
||||
"research": "feeds/research_feeds.json",
|
||||
}
|
||||
|
||||
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())
|
||||
Reference in New Issue
Block a user