Using ssh on a Mac to watch Downton Abbey on itvplayer whilst abroad

If you have a server you can ssh to in the UK, you can use it to bypass the region restrictions imposed by itvplayer and BBC iPlayer.

Christmas generally means (amongst other things, you understand) lounging around watching Downton Abbey with my parents. As they live abroad, I just take along the DVDs and all is well. However, the annual Christmas special poses a bit of a conundrum.

Last year we watched it on filmon.com, but that requires you to watch it live at the time of broadcast, and this year we couldn’t.

Fortunately, it was still available for viewing via itv’s online catch-up service, itvplayer. However, this does some geolocation to determine where you are, and refuses to play if it detects you’re outside the UK. (It seems the BBC iPlayer does the same.)

My first thought was to use an HTTP proxy running on my server in Blighty. Back in the day, we used a squid proxy in the office; all browsers were set up to proxy through the squid server, which forwarded HTTP requests to the outside world and funnelled the responses back to the browser. So the plan was to set up such a proxy on my home server back in the UK, then point Safari on my laptop at it. This would mask my foreign IP address, making traffic to itvplayer appear to originate in the UK.

These days I’d use haproxy as a lightweight proxy, but for the life of me I couldn’t work out how to make it forward requests to arbitrary destination servers rather than a pre-configured set. (haproxy is mainly used for load balancing. If anyone knows whether haproxy can do simple old-school web proxying, I’d appreciate a note in the comments)

After an hour or so of fruitless googling and experimentation I thought perhaps trusty old ssh might offer something in this area, given that I use it for all other tunneling jobs. And it turns out it does indeed, as outlined in this blog post at linuxjournal.com.

Concretely, the steps were:

  • in a terminal window, run: ssh -D 12345 your-uk-server
  • in Safari, in Preferences > Advanced > Proxies, click the button to change settings (this opens the proxies pane of the Network system preferences panel for your current network interface)
  • enable the SOCKS proxy, using localhost as the server and 12345 as the port (see screenshot)

socksproxy

That’s it – Safari supports the SOCKS protocol and will send its traffic over the ssh connection.

One caveat – your download speed will be capped at the upload speed of the remote server, since it is in effect uploading the itvplayer content to you. UK residential ADSL broadband tends to have rubbish up speed (fibre ought to be ok), so you may have trouble with playback. (Unfortunately itvplayer at least doesn’t appear to do much buffering, so you can’t just pause it for a bit to let it load up the content; you’ll have to put up with the stuttering.)

For Windows users: you can probably achieve the same thing with PuTTY. Google up “putty dynamic tunnel socks” and you should get most of the way there.

If you don’t have an ssh server available to you, or your upload speed isn’t up to it, then you may be able to google  a cheap or free UK-based VPN or HTTP proxy service which will similarly route all your traffic through the UK. Good luck!

UPDATE: BBC iPlayer download tip

It seems the Beeb have a downloader application which you can use to download stuff for later viewing. (You can get to it via the “download” options when on an iPlayer programme.) If you kick this off while the SOCKS proxy is enabled, then pause the download and turn off the SOCKS proxy in network preferences, then resume the download, it’ll download at your full broadband speed rather than being limited by the upload speed of your SOCKS proxy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: