Skip to content

Instantly share code, notes, and snippets.

@maxcohn
Last active February 6, 2019 05:42
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 maxcohn/a660d918c52413c46832973f8bb44a1f to your computer and use it in GitHub Desktop.
Save maxcohn/a660d918c52413c46832973f8bb44a1f to your computer and use it in GitHub Desktop.
Downloads all episodes of the Internet Box podcast straight from their website using Requests
# download internetbox episodes (2/6/2019)
#
# super quick script to download all episodes of the Internet Box podcast
import requests
# download function (this is a super useful function in general)
def download(url, file_name):
# open in binary mode
with open(file_name, "wb") as file:
# get request
response = requests.get(url)
# write to file
file.write(response.content)
# we have to download epsiode 1 separately beacuse it's an ogg file (why mike?)
download(f"https://traffic.libsyn.com/internetbox/InternetBoxEpisode1.ogg", f"InternetBox 001.ogg")
# create a list of all episode numbers, including x1-3
episodeNums = list(range(2,128))
episodeNums += ["x", "xx", "xxx"]
# loop through all episode numbers and download the files
for num in episodeNums:
# set flush to true beacuse they weren't printing without it
print(f"Downloading epsiode {num}...", flush=True)
# the url is constant thoughout episode numbers, so we just place the episode number there
download(f"https://traffic.libsyn.com/internetbox/InternetBoxEpisode{num}.mp3", f"InternetBox {num}.mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment