Added spotify

This commit is contained in:
Guillem Hernandez Sola
2026-04-07 19:49:56 +02:00
parent b483cf5056
commit 53dddb1f13
2 changed files with 23 additions and 36 deletions

View File

@@ -11,51 +11,37 @@ 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)
# The show name you found on Spotify
show_name = 'Diario Sport' # Replace this with the actual show name
# 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)
def find_rss_feed(show_name):
# Encode the show name for the URL
encoded_name = urllib.parse.quote(show_name)
itunes_api_url = f"https://itunes.apple.com/search?term={encoded_name}&entity=podcast&limit=3"
itunes_api_url = f"https://itunes.apple.com/search?term={encoded_name}&entity=podcast&limit=10"
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!")
found_feed = None
for result in data['results']:
# Check if the show name matches
if show_name.lower() in result['collectionName'].lower():
found_feed = result.get('feedUrl')
print("\n✅ SUCCESS! Found a matching public RSS feed:")
print("-" * 50)
print(found_feed)
break
if not found_feed:
print("\n❌ No exact match found in public directories.")
print("You may want to check the show name manually.")
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()
find_rss_feed(show_name)