laitimes

Zero-code programming: Batch download podomatic podcast RSS page audio with ChatGPT

author:AIGC Tribe

How to download audio on podomatic podcasts in batches?

Take this podcast for example: https://nosycrow.podomatic.com/rss2.xml

There is a yellow RSS feed icon on the right, click Open:

Zero-code programming: Batch download podomatic podcast RSS page audio with ChatGPT

You can see all the audio and titles:

Zero-code programming: Batch download podomatic podcast RSS page audio with ChatGPT

Looking at the source code, the audio title is in the title tag, and the mp3 audio file is in the enclosure tag:

Zero-code programming: Batch download podomatic podcast RSS page audio with ChatGPT

Enter the prompt word in ChatGPT:

You are a Python programming expert, to complete a batch download of audio files from a web page, the specific steps are as follows:

On the E drive of the local computer, create the nosycrow folder;

Open the web page https://nosycrow.podomatic.com/rss2.xml parse the source code;

Target all <item>labels;

positioning, <item><title>extract its content, delete the ":" in it, as the audio file title name;

positioning, extract the URL value<item><enclosure>, delete the "?" in the URL value? and "?" Later characters, as audio file URLs;

Download this audio file and save it to the nosycrow folder on the E drive;

Note: Each step outputs relevant information

Python source code given by ChatGPT:

Import the

import requests

from bs4 import BeautifulSoup

from concurrent.futures import ThreadPoolExecutor

# URL of the RSS feed

rss_url = "https://nosycrow.podomatic.com/rss2.xml"

# Output Information: Start downloading RSS feeds

print(f"Downloading RSS feed from {rss_url}...")

# Download RSS feeds

response = requests.get(rss_url)

rss = response.text

# Output Information: Start parsing RSS feeds

print(f"Parsing RSS feed...")

# Parsing RSS feeds

soup = BeautifulSoup(rss, "xml")

items = soup.find_all('item')

# Define a function to download audio

def download_audio(item):

# Extract the audio title and URL, and process it

audio_title = item.title.text.replace(": ", "")

audio_url = item.enclosure['url'].split("?") [0]

# Output Information: Start downloading audio

print(f"Downloading audio '{audio_title}' from {audio_url}...")

# Download audio

audio_response = requests.get(audio_url)

# Save audio to local file

audio_file_path = os.path.join("E:\\nosycrow", f"{audio_title}.mp3")

with open(audio_file_path, 'wb') as f:

f.write(audio_response.content)

# Output information: Audio download completed

print(f"Audio '{audio_title}' downloaded successfully.")

# Create a thread pool

with ThreadPoolExecutor() as executor:

# Start multi-threaded download

executor.map(download_audio, items)

# Output Information: All audio download completed

print("All audios downloaded successfully.")

Zero-code programming: Batch download podomatic podcast RSS page audio with ChatGPT

The program runs, and soon hundreds of audios are downloaded:

Zero-code programming: Batch download podomatic podcast RSS page audio with ChatGPT

Read on