I’ll introduce a script to extract RSS feed URLs from Apple Podcasts.
Extract RSS Feed URL Only with curl + egrep
curl -s "https://podcasts.apple.com/jp/podcast/podcast-name/podcast-id" \
| egrep -o 'https?://[^"]+(/rss|\.rss)'Here’s an explanation of the script:
Script Explanation
This script makes it easy to extract RSS feed URLs for podcasts on Apple Podcasts. Podcast RSS feeds are essential elements for automatically updating episodes.
Introduction to Command Line Tools
This script uses two command line tools: curl and egrep.
- curl: A tool for retrieving web page content by specifying URLs. Here, it’s used to retrieve Apple Podcasts pages.
- egrep: A tool for searching text using regular expressions. In this script, it helps identify URL patterns and extract feed URLs.
Detailed Step-by-Step Explanation
- Execute curl command
curl -s "https://podcasts.apple.com/jp/podcast/podcast-name/podcast-id"-smeans silent mode, preventing display of progress messages. It retrieves HTML data from the specified URL.
- Pipe HTML Data Processing and Regular Expression Matching
| egrep -o 'https?://[^"]+(/rss|\.rss)'- The pipe
|passes curl’s output to the next egrep. egrep -ois an option that outputs only the matched portions. The regular expressionhttps?://[^"]+(/rss|\.rss)catches the main parts that constitute URLs and extracts those containing/rssor.rss.
- The pipe
Further Applications
This script is very simple but can be applied to other web pages. Customizations are possible to extract feed URLs from other podcast platforms or web pages that provide RSS feeds.
That’s all from the Gemba.