Watching CFL games on Linux
This article is for you if you’re a Canadian football fan, you don’t have cable TV, you use an operating system which doesn’t run Microsoft Silverlight (such as Linux) and you can’t afford to go out to the bar all the time to watch football games. I may have described only one person (myself), but just in case there’s another person out there, I will describe to you how to watch your football games. I should say that while I’m no lawyer, my understanding is that what I describe here could become illegal should Bill C-32 pass, and we all hope it won’t.
The first and most important part is to install rtmpdump, a utility which you will use to actually download the video stream. I’m using a relatively ancient version of rtmpdump and I don’t think it matters particularly which version you use.
From there all that is needed is a way to get the rtmp URLs of the game you want. To use the script below, you give it a link to a game you want to download — something of the form http://watch.tsn.ca/cfl-games-on-demand/week-1-alouettes-vs-roughriders/ (one of the best football games I’ve seen in a long time, incidentally) — as an argument. It then extracts the clip IDs for each quarter (including overtime, if needed), determines the rtmp URL for each video clip, and downloads the video files in sequence.
match_name=$(echo “$1″ | sed ‘s,\(http://.*\)\(week-[^/]*\)\(.*\),\2,’)
q=0
# get through all the videos (quarters) linked to by the given game (“episode”)
for i in $(wget –q –O — “$1″ | fgrep ‘#clip’ | sed ‘s/\(.*#clip\)\([0 – 9]*\)\(.*\)/\2/’ | uniq) ; do
src=$(wget –q –O — “http://esi.ctv.ca/datafeed/flv/urlgenjs.aspx?vid=$i” | sed ‘s@\(.*\)\(rtmp://.*\.flv\)\(.*\)@\2@’ | tr –d ‘\n\r ‘)
echo “saving from $src“
echo “saving to $match_name-$q.flv“
rtmpdump –r “$src” –o “$match_name-$q.flv“
q=$(($q + 1))
done
# create dummy file so we don’t know beforehand if a game went into overtime
if [ $q –eq 4 ] ; then
touch “$match_name-$q.flv“
fi
It’s worked well for me but there are certainly no guarantees about it. CTV could break it easily if they so wanted (if you’re reading this, CTV, please don’t be meanies. Let’s be BFFs). The only unfortunate downside to it is that CTV potentially loses out on some advertising revenue. My recommendation is to stare extra hard at the commercials to make up for it on the days you do go out to the bar to watch a game. Heading out to the stadium — at the very least whenever the Riders are in town — would also be a nice way to support the league and TSN for putting games up online.
Touché. I didn’t try the whole script, which didn’t format well when
I tried to cut-and-past it to a file, but the method worked when I
used it quarter by quarter from the CLI.
Rather than rtmpdump, I use flvstreamer, which I believe is a fork.
One can stream rather than download using something like
$ rtmpdump/flvstreamer –r “rtmp://.….” –o — | mplayer –really-quiet -
I do something similar with CBC video.
Ah yes I haven’t tried flvstreamer, but I’m glad to hear you got it working!
[…] for downloading from Usenet — which is where we get almost all of our TV shows to watch, downloading CFL games from TSN and just uploading individual files from your browser. At some point I need to set up […]
Hum,
I am not able to download a cfl game with rtmpdump.
It doesn’t work anymore ?
What error do you get? I haven’t had problems with it.