Created
March 1, 2012 04:52
-
-
Save adamvr/1947360 to your computer and use it in GitHub Desktop.
A script for downloading 'This American Life' episodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tal.sh | |
A script for downloading 'This American Life' episodes | |
Requires: | |
rtmpdump | |
id3v2 | |
curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
usage() { | |
echo "Usage: `basename ${0%%.sh}` <episode_number>" 1>&2 | |
exit 1 | |
} | |
nexist() { | |
echo "Episode $1 does not exist" 1>&2 | |
exit 2 | |
} | |
echo Script starting... | |
[ $# -ne 1 ] && usage | |
ep=$1 | |
info=http://www.thisamericanlife.org/radio-archives/episode/${ep} | |
rtmp=rtmp://wbez.fcod.llnwd.net/a3989/o35/thislife/jomamashouse/ismymamashouse/${ep}.mp3 | |
echo Getting episode information... | |
curl -sfX HEAD $info || nexist $ep | |
title="$(curl -sL $info | | |
grep '<title>' | | |
sed 's/<[^<]*>//g' | | |
sed 's/ | /;/;s/^ *//' | | |
awk -F';' '{print $1}')" | |
echo Downloading episode number $ep - $title | |
output="$(echo NPR_${title}.mp3 | sed 's/ /_/g')" | |
#echo $output | |
rtmpdump -r $rtmp -o $output 2>/dev/null && echo Download complete || echo Download failed | |
echo Setting tags | |
id3v2 -a 'Chicago Public Radio' -A 'This American Life' -t "$title" -T "$ep" $output | |
echo Done |
rtmpdump -q -r "rtmp://wbez.fcod.llnwd.net/a3989/o35/thislife/jomamashouse/ismymamashouse/${ep}.mp3" -o "${ep}.flv"
ffmpeg -v 0 -i "${ep}.flv" -acodec copy "${ep}.mp3" && rm "${ep}.flv"
#!/bin/sh
usage() {
echo "Usage: `basename ${0%%.sh}` <episode_number>" 1>&2
exit 1
}
nexist() {
echo "Episode $1 does not exist" 1>&2
exit 2
}
echo Script starting...
[ $# -ne 1 ] && usage
ep=$1
info=http://www.thisamericanlife.org/radio-archives/episode/${ep}
hls=http://stream.thisamericanlife.org/${ep}/stream/${ep}_64k.m3u8
echo Getting episode information...
curl -sfX HEAD $info || nexist $ep
echo Downloading episode number $ep
ffmpeg -loglevel panic -i $hls -vn -acodec mp3 "${ep}.mp3" && echo Download complete || echo Download failed
echo Done
This should work after they moved to hls streaming, no ID3 though, just simple download.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this still work for you? The resulting mp3 seems garbled now (even though the content still seems to be in it). I wonder what changed.
./tal.sh 530
vlc:
[0x2b4294006968] mpgatofixed32 audio converter error: libmad error: bad main_data_begin pointer
[0x2b4294006968] mpgatofixed32 audio converter error: libmad error: bad main_data_begin pointer
[0x2b4294006968] mpgatofixed32 audio converter error: libmad error: bad main_data_begin pointer
[0x2b4294006968] mpgatofixed32 audio converter error: libmad error: Huffman data overrun
[0x2b4294006968] mpgatofixed32 audio converter error: libmad error: Huffman data overrun