85 lines
3.5 KiB
Python
85 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Generate RSS feed for ONLY the RAP (Revolutionary African/Afrikan Perspectives) shows
|
|
"""
|
|
|
|
from src.mixcloud_rss import MixcloudRSSGenerator
|
|
import xml.etree.ElementTree as ET
|
|
from datetime import datetime
|
|
|
|
def generate_rap_only_feed(username="WRFG"):
|
|
"""Generate RSS feed filtered for ONLY RAP shows."""
|
|
|
|
# Create generator
|
|
generator = MixcloudRSSGenerator()
|
|
|
|
# Set up filters for "RAP" in the title
|
|
# This will catch both "African" and "Afrikan" variations
|
|
filters = {
|
|
'keywords': 'RAP' # This will match "RAP - Revolutionary African/Afrikan Perspectives"
|
|
}
|
|
|
|
# Generate feed with a higher limit to catch all shows
|
|
print(f"Generating RSS feed for {username} filtered by RAP shows only...")
|
|
rss_feed = generator.generate_rss_from_username(username, limit=200, filters=filters)
|
|
|
|
if rss_feed:
|
|
# Save to file
|
|
filename = f"{username}_rap_only.xml"
|
|
with open(filename, 'w', encoding='utf-8') as f:
|
|
f.write(rss_feed)
|
|
print(f"✅ RSS feed saved to: {filename}")
|
|
|
|
# Also print the RSS URL for the web server
|
|
print(f"\n📡 RSS URL for web server:")
|
|
print(f"http://localhost:5000/rss/{username}?limit=200&keywords=RAP")
|
|
|
|
# Parse and show episodes
|
|
root = ET.fromstring(rss_feed)
|
|
items = root.findall('.//item')
|
|
print(f"\n📊 Found {len(items)} RAP episodes")
|
|
|
|
# Show episode details
|
|
if items:
|
|
print("\n📅 Revolutionary African/Afrikan Perspectives episodes:")
|
|
for item in items:
|
|
title = item.find('title').text
|
|
pub_date_str = item.find('pubDate').text
|
|
link = item.find('link').text
|
|
description = item.find('description').text if item.find('description') is not None else ""
|
|
|
|
# Parse date for better display
|
|
try:
|
|
pub_date = datetime.strptime(pub_date_str, "%a, %d %b %Y %H:%M:%S %z")
|
|
date_display = pub_date.strftime("%B %d, %Y")
|
|
except:
|
|
date_display = pub_date_str
|
|
|
|
print(f"\n 📻 {title}")
|
|
print(f" Date: {date_display}")
|
|
print(f" URL: {link}")
|
|
|
|
# Check if it's the July 21 show
|
|
if "21 july" in title.lower() or "july 21" in title.lower():
|
|
print(f" ⭐ This is the July 21 show!")
|
|
|
|
# Check for African vs Afrikan spelling
|
|
if "afrikan" in title.lower():
|
|
print(f" 📝 Note: Uses 'Afrikan' spelling")
|
|
elif "african" in title.lower():
|
|
print(f" 📝 Note: Uses 'African' spelling")
|
|
|
|
# Generate specific URL for your podcast system
|
|
print(f"\n🎯 For your podcast processing system, use this RSS URL:")
|
|
print(f"http://localhost:5000/rss/WRFG?limit=200&keywords=RAP")
|
|
|
|
# Also create a direct link to the July 21 episode
|
|
print(f"\n🔗 Direct link to July 21 RAP show:")
|
|
print(f"https://www.mixcloud.com/WRFG/public-affairs-rap-revolutionary-african-perspectives-21-july-2025/")
|
|
|
|
else:
|
|
print("❌ Error: Could not generate RSS feed")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
generate_rap_only_feed() |