Created
February 28, 2024 15:51
-
-
Save aessam/075dba06e5b41c01ffd4692038ebb89f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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