Desert Island: The Dollop

I'm going on a trip. The internet will probably be pretty horrible, at least at first.


I've been asking everyone their Desert Island Recommendations. One of mine is The Dollop. This is how you download every episode of The Dollop with a little bit of python.


You have to install python3, requests, and beautifulsoup4. I won't help you with that, but there are a load of good resources.


import time
import requests
from bs4 import BeautifulSoup
def download(href, title, extension="mp3"):
    filename = "%s.%s" % (title, extension)
    filename = filename.replace("/", "-")
    # todo, path management
    local_filename = filename
    r = requests.get(href, stream=True)
    with open(local_filename, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024):
            if chunk: # filter out keep-alive new chunks
                f.write(chunk)
    return local_filename
# The archive page lets you pick page number (1) and more importantly, episode count (500)
# This lets me ignore pagination.
all_eps_page_request = requests.get("http://thedollop.libsyn.com/webpage/page/1/size/500")
soup = BeautifulSoup(all_eps_page_request.content, 'html.parser')
table = soup.find('div', attrs={"class": "content"}).find('table')
for row in table.find_all('tr')[57:]:
    title_link = row.find('a', attrs={"class": 'postTitle'})
    try:
        title = title_link.text
    except:
        continue
    direct_link = row.find('div', attrs={"class": 'postDetails'}).find('a')
    try:
        href = direct_link.attrs['href']
    except:
        continue
    print(title, href)
    download(href, title)
    print("*")
    # Be a little kind to their server
    time.sleep(1)

Comments and Messages

I won't ever give out your email address. I don't publish comments but if you'd like to write to me then you could use this form.

Issac Kelly