Downloading Tanis
Posted by Admin on 4. February, 2022
Tanis is podcast series, now ended, and I wanted to download it. Here's what I did.
First get the episode list.
I use claws-mail and subsribe to the RSS feed, From this I can ceate an podcast list.
cd /home/username/.claws-mail/RSSyl/My Feeds (RSSyl)/TANIS grep https://traffic.libsyn.com/secure/tanis/TANIS_EPISODE_ * | grep X-RSSyl-URL: > /home/username/entertainment/TANIS/EPISODES.txt
Now we have episode list, Yay! So we can parse this lisr and get the episodes. Python code below:
import eyed3
from glob import glob
import html2text
import logging
import os
import pathlib
import requests
from time import sleep
import sys
infile = "EPISODES.txt"
episodes = []
f = open(infile, "rt")
episodes = f.readlines()
f.close()
# Strip stuff
eps = []
all_pods = []
for ep in episodes:
url = ep.split('URL:')[1].strip()
all_pods.append(os.path.basename(url))
eps.append(url)
print(all_pods)
downloaded = glob("*.mp3")
toget = []
for ap in all_pods:
if ap not in downloaded:
toget.append(ap)
print(ap)
base_url = "https://traffic.libsyn.com/secure/tanis/"
print("Getting files")
for podcast in toget:
print(os.path.join(base_url, podcast))
r = requests.get(os.path.join(base_url, podcast), allow_redirects=True)
print(r.status_code)
#continue
print("Downloading the episode, please wait")
open(podcast, "wb").write(r.content)
print("Episode downloaded")
sleep(10)
pod_files = glob("*.mp3")
pod_files.sort()
f = open("TANIS.m3u", "wt")
for pod in pod_files:
f.write(pod)
f.write("\n")
f.close()
Done!
Now load the playlist into VLC and listen.
Last changed: 4. February, 2022 at 20:35
Back to Overview