Watching CFL games on Linux

July 2, 2010 in Personal | Comments (5)

This art­icle is for you if you’re a Cana­dian foot­ball fan, you don’t have cable TV, you use an oper­at­ing sys­tem which doesn’t run Microsoft Sil­ver­light (such as Linux) and you can’t afford to go out to the bar all the time to watch foot­ball games. I may have described only one per­son (myself), but just in case there’s another per­son out there, I will describe to you how to watch your foot­ball games. I should say that while I’m no law­yer, my under­stand­ing 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 import­ant part is to install rtm­p­dump, a util­ity which you will use to actu­ally down­load the video stream. I’m using a rel­at­ively ancient ver­sion of rtm­p­dump and I don’t think it mat­ters par­tic­u­larly which ver­sion 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 down­load — some­thing of the form http://​watch​.tsn​.ca/​c​f​l​-​g​a​m​e​s​-​o​n​-​d​e​m​a​n​d​/​w​e​e​k​-​1​-​a​l​o​u​e​t​t​e​s​-​v​s​-​r​o​u​g​h​r​i​d​e​rs/ (one of the best foot­ball games I’ve seen in a long time, incidentally) — as an argu­ment. It then extracts the clip IDs for each quarter (includ­ing over­time, if needed), determ­ines the rtmp URL for each video clip, and down­loads the video files in sequence.

#!/​bin/​bash
match_​name=$(echo “$1″ | sed ‘s,\(http://.*\)\(week-[^/]*\)\(.*\),\2,’)
q=0
# get through all the videos (quar­ters) linked to by the given game (“epis­ode”)
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/​d​a​t​a​f​e​e​d​/​f​l​v​/​u​r​l​g​e​n​j​s​.​a​s​p​x​?​vid=$i | sed ‘s@\(.*\)\(rtmp://.*\.flv\)\(.*\)@\2@’ | tr –d ‘\n\r ‘)
        echo “sav­ing from $src
        echo “sav­ing to $match_​name-$q.flv“
        rtm­p­dump –r $src –o $match_​name-$q.flv“
        q=$(($q + 1))
done
# cre­ate dummy file so we don’t know before­hand if a game went into over­time
if [ $q –eq 4 ] ; then
        touch $match_​name-$q.flv“
fi

It’s worked well for me but there are cer­tainly no guar­an­tees about it. CTV could break it eas­ily if they so wanted (if you’re read­ing this, CTV, please don’t be mean­ies. Let’s be BFFs). The only unfor­tu­nate down­side to it is that CTV poten­tially loses out on some advert­ising rev­enue. My recom­mend­a­tion is to stare extra hard at the com­mer­cials to make up for it on the days you do go out to the bar to watch a game. Head­ing out to the sta­dium — at the very least whenever the Riders are in town — would also be a nice way to sup­port the league and TSN for put­ting games up online.


5 Responses to “Watching CFL games on Linux”

RSS feed for comments on this post. TrackBack URL

  1. Comment by Howard EisenbergerJuly 21, 2010 at 3:11 am   Reply

    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 rtm­p­dump, I use flvstreamer, which I believe is a fork.
    One can stream rather than down­load using some­thing like
    $ rtmpdump/​flvstreamer –r “rtmp://.….” –o — | mplayer –really-​​quiet -
    I do some­thing sim­ilar with CBC video.

  2. Comment by Our media server « Wizardlike researchJuly 26, 2010 at 10:52 am   Reply

    […] for down­load­ing from Usenet  —  which is where we get almost all of our TV shows to watch, down­load­ing CFL games from TSN and just upload­ing indi­vidual files from your browser. At some point I need to set up […]

  3. Comment by Sam — August 24, 2010 at 5:28 am   Reply

    Hum,
    I am not able to down­load a cfl game with rtm­p­dump.
    It doesn’t work anymore ?

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>