Added spotify
This commit is contained in:
1
media/.cache
Normal file
1
media/.cache
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"access_token": "BQDgExV1x8UWOU7F4SlKfHZXvpt_BopkdNKRer5JVumrSLqUGyqob7TiynJoa7L6rruy9_i97PH7IAwQZRhqwHOHyaOmvieH8lc0JUf1fxBiEYQRXsOg7izv4Obp1inLJF6898liuvc", "token_type": "Bearer", "expires_in": 3600, "expires_at": 1775587275}
|
||||||
@@ -11,51 +11,37 @@ SPOTIPY_CLIENT_SECRET = '6c8ea8c409d944cc895571f3f49985df'
|
|||||||
# The ID from your link: https://open.spotify.com/show/13Gs651PIKKI7zRF0p3PcJ
|
# The ID from your link: https://open.spotify.com/show/13Gs651PIKKI7zRF0p3PcJ
|
||||||
SHOW_ID = '13Gs651PIKKI7zRF0p3PcJ'
|
SHOW_ID = '13Gs651PIKKI7zRF0p3PcJ'
|
||||||
|
|
||||||
def find_real_rss_feed():
|
# The show name you found on Spotify
|
||||||
# Step 1: Authenticate with Spotify
|
show_name = 'Diario Sport' # Replace this with the actual show name
|
||||||
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
|
def find_rss_feed(show_name):
|
||||||
print(f"Fetching details for Spotify Show ID: {SHOW_ID}...")
|
# Encode the show name for the URL
|
||||||
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)
|
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:
|
try:
|
||||||
response = requests.get(itunes_api_url)
|
response = requests.get(itunes_api_url)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
if data['resultCount'] > 0:
|
if data['resultCount'] > 0:
|
||||||
# Grab the first result's RSS feed URL
|
found_feed = None
|
||||||
# We check the first few results to ensure the author matches, but usually the first is correct
|
for result in data['results']:
|
||||||
real_rss_url = data['results'][0].get('feedUrl')
|
# Check if the show name matches
|
||||||
|
if show_name.lower() in result['collectionName'].lower():
|
||||||
print("\n✅ SUCCESS! Found the public RSS feed:")
|
found_feed = result.get('feedUrl')
|
||||||
print("-" * 50)
|
print("\n✅ SUCCESS! Found a matching public RSS feed:")
|
||||||
print(real_rss_url)
|
print("-" * 50)
|
||||||
print("-" * 50)
|
print(found_feed)
|
||||||
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!")
|
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:
|
else:
|
||||||
print("\n❌ Could not find this show in public directories.")
|
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:
|
except Exception as e:
|
||||||
print(f"Error searching iTunes: {e}")
|
print(f"Error searching iTunes: {e}")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
find_real_rss_feed()
|
find_rss_feed(show_name)
|
||||||
Reference in New Issue
Block a user