<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>delx &#187; hulu</title>
	<atom:link href="http://delx.net.au/blog/tag/hulu/feed/" rel="self" type="application/rss+xml" />
	<link>http://delx.net.au/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 13 Apr 2012 14:05:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Who wants Hulu?</title>
		<link>http://delx.net.au/blog/2009/03/who-wants-hulu/</link>
		<comments>http://delx.net.au/blog/2009/03/who-wants-hulu/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 13:15:37 +0000</pubDate>
		<dc:creator>delx</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[censorship]]></category>
		<category><![CDATA[hulu]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[tv]]></category>

		<guid isPermaLink="false">http://delx.net.au/blog/?p=128</guid>
		<description><![CDATA[This guide is out of date! Please see the new guide here: Hulu and Pandora outside USA Hulu is a website that offers commercial-supported streaming video of TV shows and movies from NBC, Fox and many other networks and studios. Currently Hulu is only available from within the United States of America. If you want [...]]]></description>
			<content:encoded><![CDATA[<p><strong>This guide is out of date! Please see the new guide here:</strong><br />
<a href="http://delx.net.au/blog/2011/12/hulu-and-pandora-outside-usa/">Hulu and Pandora outside USA</a></p>
<p>Hulu is a website that offers commercial-supported streaming video of TV shows and movies from NBC, Fox and many other networks and studios. Currently Hulu is only available from within the United States of America.</p>
<p>If you want to be notified of updates to this post, subscribe to the <a href="feed">comments feed</a>.</p>
<p><span id="more-128"></span></p>
<p>This is kind of lame. One of the fundamental principles of the internet is global access. That&#8217;s why we have the <i>world wide</i> web, not the America-web.</p>
<p>So, in that spirit, here&#8217;s how to make Hulu fully functional on your local network and accessible from any ordinary web browser.</p>
<h4>Requirements</h4>
<ul>
<li>A machine in the US that you can run programs and serve web pages from.</li>
<li>A Linux machine at home that shares your net connection</li>
</ul>
<h4>For my friends</h4>
<p>You can skip the USA proxy configuration and just use <tt>72.232.203.84</tt> everywhere you would put that server&#8217;s IP.<br />
Make sure you email me and I&#8217;ll add your local IP address to the allow list for the RTMP proxy.</p>
<h4>USA Proxy Configuration</h4>
<p>First we need to set up your US server to forward some selected HTTP sites as well as the Flash RTMP video streams. Do these steps on the server in the US:</p>
<ul>
<li>Create a file, hulu_proxy.ini with these contents:
<pre>
[proxy]
mode = proxy
listen_port = 9997

[allowed]
host1 = YOUR_LOCAL_IP_OR_DOMAIN
</pre>
<li>Download <a href="http://delx.net.au/hg/jamesstuff/raw-file/tip/scripts/proxy.py">proxy.py</a> and run this command to start forwarding requests on port 9997 from the allowed hosts.
<pre>proxy.py -d hulu_proxy.ini</pre>
</li>
<li>Create an HTTP virtual server for these domains: <tt>releasegeo.hulu.com</tt></li>
<li>Download <a href="http://delx.net.au/hg/cgiproxy/raw-file/tip/ruby/proxy.rb">proxy.rb</a> and <a href="http://delx.net.au/hg/cgiproxy/raw-file/tip/ruby/path.cgi">path.cgi</a> to these virtual hosts.</li>
<li>Edit path.cgi to end with
<pre>proxyTo "http://" + ENV["HTTP_HOST"], False</pre>
</li>
<li>
<li>Now set up a rewrite rule to forward <tt>/</tt> to <tt>/path.cgi</tt> for each of these virtual hosts.</li>
</ul>
<h4>Local network</h4>
<p>If you have a Linux router you can configure it to forward all packets destined for Hulu from inside your network to your US server.<br />
Follow these steps on your LAN&#8217;s router or your on any Linux computer:</p>
<ul>
<li>Add this to your <tt>/etc/hosts</tt> file (these addresses may be out of date, see the last section in this blog):
<pre>
XXX.YYY.ZZZ.AAA releasegeo.hulu.com
205.241.224.55 cp41752.edgefcs.net # HULU
205.241.224.45 cp39465.edgefcs.net # HULU
205.241.224.158 cp51756.edgefcs.net # HULU
205.241.224.37 cp47346.edgefcs.net # HULU
</pre>
<p>where <tt>XXX.YYY.ZZZ.AAA</tt> is the IP address of your US server.</li>
<li>If you&#8217;re using dnsmasq for your LAN&#8217;s DNS server ensure that it reads these addresses from your and resolves them for hosts on your network.</li>
<li>Add this to your firewall config for Linux:
<pre>
grep 'HULU$' /etc/hosts | awk '{print $1;}' | while read huluip; do
    iptables -t nat -A PREROUTING -i eth0 -p tcp \
        --destination "$huluip"  --dport 1935 -j REDIRECT --to-ports 9997
    iptables -t nat -A OUTPUT -p tcp \
        --destination "$huluip" --dport 1935 -j REDIRECT --to-ports 9997
done
</pre>
</li>
<li>Add this to your firewall config for OSX:
<pre>
grep 'HULU$' /etc/hosts | awk '{print $1;}' | while read huluip; do
    ipfw add 50000 fwd 127.0.0.1,9997 \
        tcp from any to "$huluip" dst-port 1935
done
</pre>
</li>
<li>Create a file, hulu_interceptor.ini with these contents:
<pre>
[proxy]
mode = interceptor
listen_port = 9997
host = XXX.YYY.ZZZ.XXX
port = 9997
</pre>
</li>
<li>Download <a href="http://delx.net.au/hg/jamesstuff/raw-file/tip/scripts/proxy.py">proxy.py</a> and run this command to start capturing and forwarding the Flash RTMP port to your US server.
<pre>proxy.py -d hulu_interceptor.ini</pre>
</li>
</ul>
<p>Some ISPs in Australia (Internode, iiNet and others) override the DNS entries for Akamai servers. This is why the modification to <tt>/etc/hosts</tt> is needed. Note that using the rules above, only traffic to specific Akamai Flash RTMP servers will go through your US server. So unmetered ABC iView content will remain unmetered. However, if Hulu adds new servers to this list, or if I&#8217;ve missed some, then some videos may not work and the hosts file will need updating.</p>
<p>If you are having difficulty viewing videos and you suspect that this is the issue, try running this tcpdump command to see whether your connections are being sent to a server within your ISPs address range:</p>
<pre># tcpdump -i INTERFACE port 1935</pre>
<p>You&#8217;ll then need to find the corresponding domain name and the &#8216;correct&#8217; IP to add to <tt>/etc/hosts</tt></p>
<h4>Automatic <tt>/etc/hosts</tt> updating</h4>
<p>The <tt>/etc/hosts</tt> file is used to know which IP addresses to route over the tunnel to USA. My USA server resolves the Hulu video hosts that I know about and makes them available at this URL: <a href="http://delx.net.au/files/huluhosts.txt">http://delx.net.au/files/huluhosts.txt</a>. This is automatically updated every hour.</p>
<p>I use a daily cronjob on my client machines in order to keep their hosts file up to date. Adapt this to your needs.</p>
<pre>
#!/bin/bash

cp /etc/hosts /etc/hosts.hulubak &#038;&#038;
grep -v HULU /etc/hosts > /etc/_hosts.new &#038;&#038;
curl -s http://delx.net.au/files/huluhosts.txt >> /etc/_hosts.new &#038;&#038;
chmod 0644 /etc/_hosts.new &#038;&#038;
mv /etc/_hosts.new /etc/hosts &#038;&#038;

# Ensure you clear the previous Hulu firewall rules and restart your
# DNS server (if you use one)
/root/hulutables
/etc/init.d/dnsmasq restart > /dev/null
</pre>
]]></content:encoded>
			<wfw:commentRss>http://delx.net.au/blog/2009/03/who-wants-hulu/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>

