Skip to content

Instantly share code, notes, and snippets.

@aessam
Created February 28, 2024 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aessam/075dba06e5b41c01ffd4692038ebb89f to your computer and use it in GitHub Desktop.
Save aessam/075dba06e5b41c01ffd4692038ebb89f to your computer and use it in GitHub Desktop.
import requests
def lookup_podcasts(search_term):
base_url = "https://itunes.apple.com/search"
params = {
"term": search_term,
"media": "podcast",
"limit": 10 # Adjust the limit as needed
}
response = requests.get(base_url, params=params)
if response.status_code == 200:
results = response.json().get('results', [])
if results:
for i, podcast in enumerate(results, start=1):
print(f"Podcast {i}: {podcast['trackName']}")
print(f" Artist: {podcast['artistName']}")
print(f" Feed URL: {podcast['feedUrl']}")
print(f" Description: {podcast['collectionCensoredName']}")
print(f" iTunes Link: {podcast['collectionViewUrl']}\n")
else:
print("No podcasts found.")
else:
print(f"Failed to search iTunes API. Status code: {response.status_code}")
# Example usage
search_term = input("Enter search term: ")
lookup_podcasts(search_term)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment