-
-
Save stefanschmidt/923607 to your computer and use it in GitHub Desktop.
The Daily Show Downloader
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/bash | |
# | |
# This script depends on curl and rtmpdump. | |
# For playback I recommend mplayer. | |
# Suggestions are welcome. | |
# | |
RTMPDUMP="rtmpdump" # the name of the binary | |
set -eu | |
if [ $# = 1 ] && [ ${#1} = 6 ] ; then | |
ID="$1" | |
elif [ $# = 1 ] && echo "$1" | grep -E -q "http://media.mtvnservices.com/mgid:cms:[^:]+:comedycentral.com:[0-9]+" ; then | |
ID=`echo "$1" | cut -d : -f 6` | |
elif [ $# = 1 ] && echo "$1" | grep -E -q "http://.+" ; then | |
if ! ID=`curl -s "$1" | sed -En 's/.*"video_([0-9]+)".*/\1/p'`; then | |
echo "error: could not extract video id" | |
exit 1 | |
fi | |
else | |
BA=`basename "$0"` | |
echo "usage:" | |
echo " $BA \${ID}" | |
echo " $BA http://www.thedailyshow.com/full-episodes/\${ID}/title-of-the-episode" | |
echo " $BA http://www.thedailyshow.com/watch/some-kind-of-date/title-of-video" | |
# echo " $BA http://www.comedycentral.com/colbertreport/full-episodes/index.jhtml?episodeId=\${ID}" | |
echo " $BA http://www.colbertnation.com/full-episodes/date-and-title-of-the-episode" | |
echo " $BA http://media.mtvnservices.com/mgid:cms:item:comedycentral.com:\${ID}" | |
echo " $BA http://media.mtvnservices.com/mgid:cms:video:comedycentral.com:\${ID}" | |
echo " $BA http://media.mtvnservices.com/mgid:cms:fullepisode:comedycentral.com:\${ID}" | |
exit 1 | |
fi | |
echo "ID = $ID" | |
RTMPDUMP_OPTS="--swfUrl "http://media.mtvnservices.com/player/prime/mediaplayerprime.1.7.0.swf" --swfsize 1983727 --swfhash 0884b06decee5e866a24792f198b4b88f7232e9da92f1e5520ca330822f0d4f9 --resume" | |
GEN_URL="http://shadow.comedycentral.com/feeds/video_player/mrss/?uri=mgid%3Acms%3Aepisode%3Acolbertnation.com%3A{$ID}" | |
PARTS=`curl -s "$GEN_URL" | grep media:content | grep -v bumper | sed -En 's/.*url="([^"]+)".*/\1/p'` | |
echo -n "PARTS = " ; echo $PARTS | |
FILENAMES="" | |
# download parts in parallel | |
for X in $PARTS ; do | |
VIDEO_URL=`curl -s "$X" | sed -En 's/.*rtmpe([^<]+)<.*/rtmp\1/p' | tail -1` | |
echo "VIDEO_URL = $VIDEO_URL" | |
FILENAME=`basename "$VIDEO_URL"` | |
$RTMPDUMP $RTMPDUMP_OPTS -o "$FILENAME" -r "$VIDEO_URL" & | |
FILENAMES="$FILENAMES $FILENAME" | |
done | |
wait | |
# here is an example of how you can combine the parts into a proper video: | |
# NOTE: downloaded files are not actually in mp4 format! | |
# | |
#mv ds_15001_01_640x360_1300.mp4 ds_15001_01_640x360_1300.flv | |
#mv ds_15001_02_640x360_1300.mp4 ds_15001_02_640x360_1300.flv | |
#mv ds_15001_03_640x360_1300.mp4 ds_15001_03_640x360_1300.flv | |
#mv ds_15001_04_640x360_1300.mp4 ds_15001_04_640x360_1300.flv | |
# | |
#ffmpeg -acodec copy -vcodec copy -i ds_15001_01_640x360_1300.flv ds_15001_01_640x360_1300.mp4 | |
#ffmpeg -acodec copy -vcodec copy -i ds_15001_02_640x360_1300.flv ds_15001_02_640x360_1300.mp4 | |
#ffmpeg -acodec copy -vcodec copy -i ds_15001_03_640x360_1300.flv ds_15001_03_640x360_1300.mp4 | |
#ffmpeg -acodec copy -vcodec copy -i ds_15001_04_640x360_1300.flv ds_15001_04_640x360_1300.mp4 | |
# | |
#MP4Box -add ds_15001_01_640x360_1300.mp4 -cat ds_15001_02_640x360_1300.mp4 -cat ds_15001_03_640x360_1300.mp4 -cat ds_15001_04_640x360_1300.mp4 -new ds_15001.mp4 | |
# | |
echo | |
echo "play it with:" | |
echo "mplayer -fixed-vo -fs${FILENAMES}" |
Sorry to bother you but is there any way you could update this again? Also, did you manage to rip the full shows yourself?
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rlly old I know, but was this ever fixed?