Elevate Your Podcast Experience: Using Apple Shortcuts to Play Random Episodes (and NGINX)
Podcasts have become an integral part of my daily routine, and accessing them seamlessly is crucial for a smooth listening experience. In this guide, I’ll explore how you can leverage Nginx to offer a JSON file containing links to podcast episodes.
Additionally, I’ll demonstrate how iPhone users can use the Shortcuts app to load the JSON file, extract a random entry, and open the URL for their preferred podcast service.
The following is one of many ways / tldr
It’s up to you as a user or the podcaster to host your episodes in a way that allows you to access them via a JSON file. Then load this via the Shortcut app and use the Get Dictionary Value action to extract a random entry from the JSON file. Finally, use the Open URLs action to open the URL in your preferred podcast app.
The following code will be pseudo code and just guide you a little.
Setting Up Nginx to Serve JSON
Nginx is a powerful web server that can be used to serve static files, including JSON. Here’s a quick example of an Nginx configuration to serve a podcast.json file:
server {
listen 80;
server_name yourdomain.com;
location /podcasts {
alias /path/to/your/json/files;
index podcast.json;
}
}
Replace yourdomain.com with your actual domain and adjust the path accordingly. Make sure the JSON file contains an array of podcast entries, each with a title and url pointing to the podcast episode.
Creating the Podcast JSON File
Here’s an example of how your podcast.json file might look:
[
{
"title": "Podcast Episode 1",
"url": "https://spotify.com/episode1"
},
{
"title": "Podcast Episode 2",
"url": "https://applepodcasts.com/episode2"
},
// Add more entries as needed
]
An Array of objects.
Using Shortcuts on iPhone
- Get the Shortcuts app from the App Store.
- Setup a new shortcut
Then, add the following actions to your shortcut:
- Get contents of
https://yourdomain.com/podcasts/podcast.json
- Get
Random Item
fromGet Contents of URL
- Get
Dictionary
fromItem from List
- Get
Random Item
fromDictionary
- Get
Value
foryour-key-in-the-json
fromDictionary
- Open
Dictionary Value
Tada 🥳🪄✨
⬅️ Read previous Read next ➡️