This is 2014, and so it's possible to watch just about anything online, right? Right. It just takes a little patience ... sit down and pull up a chair, and I'll tell you a story that will curl your hair.
So I'm a cycling fan, and today the UCI World Championship road race took place in Ponferrada, Spain. Naturally, I wanted to watch it, and naturally, this important sports event is not broadcast on US network television. Eastern Carolina State vs. Northwestern Ohio, yes, Cycling World Championships, no. But I digress. (I will be doing a fair amount of digressing here, please hang in there.)
Okay, so I find the LIVE feed of this event on YouTube. Phil Liggett is commentating, this is the real deal. Yay!
Of course, if that was the end of it this wouldn't be a blog post named "advanced yak shaving", so you already know, this was not the end of it. It was just the very start. Onward.
I click play. "The uploader has not made this video available in this country." Crappo. I love this sort of bogus restriction. What does "this country" even mean in this context? It means I am using an IP address which YouTube has identified as being in the United States, and the uploader ("UCI Channel") has decided they want to sell this content in the United States, so I can't play it on YouTube. So be it.
Now just to be clear, I now face two problems. First, I want to download the YouTube video, so I can store it on my server, so I can watch it on my big TV via my Apple TV. And Second, I want to do this from an IP address which is not identified by YouTube as being in the US. Either of these problems by itself can be solved. I can download YouTube videos via Savefrom.net. And I can watch YouTube videos from Europe via Proxfree.com. Yay. (Both of these services only exist to route around YouTube. Bless them.)
But neither of these solutions work for me, because I need both of them. I can't download this video via Savefrom.net because it is also located in the US, and also faces the "not available in this country" restriction. And Proxfree.com merely enables watching, not downloading. And I can't somehow "pipeline" these together. So... what to do.
I set up a server in Ireland.
Yes of course, the obvious solution! I use Amazon web services all the time, and it is downright trivial to configure a new server. Amazon has a datacenter in Ireland, so if I setup a new server there, I can use it to download the video. Easy as pie.
So I set up a new Windows 2008 Server in Ireland (details omitted) and log in. All cool. By the way it is absolutely amazing how fast it is to RDP into a server halfway around the world. Those little electrons are pretty speedy.
Now remember I have two problems. Setting up a server in Ireland overcomes the "video not available in this country" problem, but it doesn't solve the download problem. For that I will need a browser extension.
Time to setup Chrome. Why Chrome? Well because Chrome supports HTML5 video, so this way I won't need to install Flash. And I do not want to install Flash. So I have to launch Internet Explorer to download Chrome. Now out of the box Internet Explorer is a real steaming pile, especially on a Windows Server. The default security precautions will literally keep you from doing anything useful, and disabling them is not easy. It took me about twenty five clicks and dialog boxes and warnings just to download Chrome. But yay, it was done.
Next step, I needed to install a YouTube download extension for Chrome. There are a bunch of these, just pick one, install it, and poof I'm off the races. Um, no. You see, in their infinite wisdom, Google have recently decided to make it impossible to install Chrome extensions which don't come from the Google Chrome download store. I tried a bunch of stuff like putting Chrome in Developer Mode, all to no avail. Why are they such assholes about this? Well Google own YouTube, so they want to prevent extensions which route around YouTube's restrictions such as allowing downloads. Okayyy.
Time to setup Firefox. This will mean installing Flash, because Firefox doesn't support HTML5 video, but at least Firefox won't keep me from installing a download extension. So I use Chrome to download Firefox, and then find a suitable Firefox extension to download YouTube videos, and then install Flash to access the video from Firefox so I can download it. In the process, I tell Adobe nicely that no I do not want to buy Photoshop and Lightroom together. Nice puppy though.
It was at exactly this point that I decide I had moved into the realm of advanced yak shaving, and started this blog post. Slacker cues up "Pearl Necklace" by ZZTop, and off we go.
So I restart Firefox, reload the YouTube video URL, and ... the video doesn't play! Um, what? Well ... it turns out that by default, when RDP connects to a server, it uses 16-bit color instead of 24-bit. Which is not supported by Flash. Okay Mr. Google, how do I change Terminal Server to use 24-bit? (A lot of crappy Windows config detail goes here.) Okay, fixed that.
Now I'm ready! I can play the video in Firefox, and I have a Download button. I click download and poof! The entire 2.2GB MP4 video file downloads in less than two minutes, at 30MB/s. Wow. Amazon certainly has beautiful bandwidth. So that's done, I have the video downloaded...
But it is now on a server in Ireland. How best to get a 2.2GB file from Ireland to my house? Well, the transfer needs to be fast and it needs to be recoverable. So next step is setting up FTP on the server. That's easy, right?
Yep, setting up FTP is a piece of cake. You just have to remember that under Windows, FTP is part of Web serving. Which means Internet Information Server. And to setup IIS on a server, you must add a role. (Of course, that makes sense.) A few thousand clicks later, I have an FTP server up and running. Now to connect a client and start the transfer...
Um, no. About that "connect" part. It turns out Windows Firewall is blocking everything! Aha I've been here before, and I know that configuring Windows Firewall to enable FTP serving is basically impossible, because nobody who knows all the steps is young enough actually to perform all the steps. So instead I disable Windows Firewall entirely > netsh advfirewall set allprofiles state off. Take that!
But I'm not done yet. I also have to enable FTP in the Amazon Security Group. No problem at all, I don't want to screw around here, so I enable every single TCP/IP port in both directions. Whew.
Now I can connect, but I can't yet start the transfer, because I can't yet see the file. Oh crap, Windows file permissions. Have you ever - ever - found file permissions to be useful? Me neither. And unfortunately unlike Windows Firewall, you can't disable Windows file permissions with a single command. So I screw around with this for a while, and after a few thousand clicks I have made it possible to "see" the file remotely, and I can start the transfer. Yay!
And so two hours later ... I have the file. And I can play it on my big TV via Apple TV. And I settle down to watch the UCI World Cycling Championships...
[Update: Michel Kwiatkowski wins! ... in a great race. Sure glad I had a chance to watch!]