61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
import spotipy
|
|
from spotipy.oauth2 import SpotifyClientCredentials
|
|
import requests
|
|
import urllib.parse
|
|
|
|
# --- Configuration ---
|
|
# Replace these with your actual Spotify Developer credentials
|
|
SPOTIPY_CLIENT_ID = '3756ae92386d45e9971aa03d2f4b1eca'
|
|
SPOTIPY_CLIENT_SECRET = '6c8ea8c409d944cc895571f3f49985df'
|
|
|
|
# The ID from your link: https://open.spotify.com/show/13Gs651PIKKI7zRF0p3PcJ
|
|
SHOW_ID = '13Gs651PIKKI7zRF0p3PcJ'
|
|
|
|
def find_real_rss_feed():
|
|
# Step 1: Authenticate with Spotify
|
|
auth_manager = SpotifyClientCredentials(
|
|
client_id=SPOTIPY_CLIENT_ID,
|
|
client_secret=SPOTIPY_CLIENT_SECRET
|
|
)
|
|
sp = spotipy.Spotify(auth_manager=auth_manager)
|
|
|
|
# Step 2: Get the Show Name from Spotify
|
|
print(f"Fetching details for Spotify Show ID: {SHOW_ID}...")
|
|
try:
|
|
show = sp.show(SHOW_ID)
|
|
show_name = show['name']
|
|
publisher = show['publisher']
|
|
print(f"Found Show: '{show_name}' by {publisher}")
|
|
except Exception as e:
|
|
print(f"Error fetching from Spotify: {e}")
|
|
return
|
|
|
|
# Step 3: Search the iTunes API for that Show Name
|
|
print("\nSearching public directories (iTunes) for the real RSS feed...")
|
|
# We encode the name so it can be safely used in a URL (e.g., spaces become %20)
|
|
encoded_name = urllib.parse.quote(show_name)
|
|
itunes_api_url = f"https://itunes.apple.com/search?term={encoded_name}&entity=podcast&limit=3"
|
|
|
|
try:
|
|
response = requests.get(itunes_api_url)
|
|
data = response.json()
|
|
|
|
if data['resultCount'] > 0:
|
|
# Grab the first result's RSS feed URL
|
|
# We check the first few results to ensure the author matches, but usually the first is correct
|
|
real_rss_url = data['results'][0].get('feedUrl')
|
|
|
|
print("\n✅ SUCCESS! Found the public RSS feed:")
|
|
print("-" * 50)
|
|
print(real_rss_url)
|
|
print("-" * 50)
|
|
print("You can copy and paste this URL directly into Apple Podcasts, Pocket Casts, or any standard RSS reader. It contains all the real .mp3 files!")
|
|
else:
|
|
print("\n❌ Could not find this show in public directories.")
|
|
print("This usually means the podcast is a 'Spotify Exclusive' and does not have a public RSS feed.")
|
|
|
|
except Exception as e:
|
|
print(f"Error searching iTunes: {e}")
|
|
|
|
if __name__ == '__main__':
|
|
find_real_rss_feed() |