4OD Channel 4 television, on demand, for the UK
So 4OD has a great collection of TV series that you can watch back to back. After watching about five episodes of peep show I found the adverts repetitive and annoying and decided to have a look at removing them. A brief search on the net and I found Steve Larsen had found a method. His instructions state that by redirecting three hosts to your loopback the adverts will not be played. I did this and for some quick tests I found it to work.
My setup, following instructions
I set my router’s parental control to redirect the following URL s to 127.0.0.1
s0.2mdn.net
realmedia.channel4.com
webstat.channel4.com
I did this in the hope that I would not have to reconfigure the hosts file on the various computers around my house.
Problem
I found that on machines that had viewed 4OD then adverts did not play but on machines that have never been to 4OD they hung while attempting to play and showed nothing but a blank screen.
Investigation
To investigate what was going on I disabled the redirect on my router and cookies and caching on a browser and ran up WireShark and captured the packets from a successful viewing of 4OD.
- I used Jamie Does as a test.
- The first packet of interest is this request to channel 4.
http://www.channel4.com/programmes/jamie-does/4od/asset/3070154?1274958589 - In the xml response there is a node “adverts” with a “targetingUri” child that looks interesting.
http://realmedia.channel4.com/RealMedia/ads/adstream_sx.ads/channel4.newcu/channel4/channel4/c4food/48367/48367/006/1813730249
- The next packet of interest is this request
http://realmedia.channel4.com/crossdomain.xml
- Finally this request
http://realmedia.channel4.com/RealMedia/ads/adstream_sx.ads/channel4.newcu/channel4/channel4/c4food/48367/48367/006/1813730249@x59,x60,x61,x80,x81,x90,x91,x92,x93
- The response contains a load of rtml urls interceded with remarks with clipping times.
Removing adverts solution, personal use.
So seeing as just looping back realmedia.channel4.com to localhost ends up with a hang if there is no cache of the final request then it will need to generate my own response using some php and some url re-writing on my local apache and php web server.
- Set in hosts file 127.0.0.1 to be realmedia.channel4.com
127.0.0.1 realmedia.channel4.com - Setup url rewriting on local web server in .htaccess
RewriteRule ^crossdomain.xml$ /tv.php?cd=1 [L]
RewriteRule ^RealMedia\/ads\/adstream_sx\.ads /tv.php [L] - Generate a php page to service requests.
if (isset($_GET['cd'])) {
echo '<?xml version="1.0"?>'.PHP_EOL;
echo '<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">'.PHP_EOL;
echo ' <cross-domain-policy>'.PHP_EOL;
echo ' <allow-access-from domain="*" />'.PHP_EOL;
echo '</cross-domain-policy>';
} else {
echo PHP_EOL;
}
In the above requests for the crossdomain.xml are served normally however the rtmp links are not generated at all, these rtmp links are the locations of adverts to be played, non specified, non played.
An example of the crossdomain.xml
An example of the null advert file
Removing adverts solution, personal network.
- Same as above except step 1 is not to alter hosts file but to setup a redirect to my server on my routers parental control. So.
realmedia.channel4.com REDIRECT MyServerName
Removing adverts solution, solution for everyone.
I have enabled a static ip server I had admin rights over to provide the fake information required. One can add a host entry (c:\windows\system32\drivers\etc\hosts – launch notepad with admin rights) for
realmedia.channel4.com
to point at
195.12.28.114
in the end it should look like something like this:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
195.12.28.114 realmedia.channel4.com
Once done, open a command and tye nbtstat -R and ipconfig /flushdns or just reboot and yay no more ads.
Ingenious! 4OD in our house is now ad free.
Although I seem to have broken mythweb in the process…..
I have enabled a static ip server I have admin rights over to provide the fake information required. One can add a host entry for
realmedia.channel4.com
to point at
195.12.28.114
Thanks Chris! That is just great, looking forward to hearing more in this direction!
You Sir are a star. Thanks for sharing
I’ve just done the modification to my hosts file but the ads still play on 4OD. I’m using firefox 13 with noscript and i’ve added 195.12.28.114 to the whitelist. Maybe C4 no longer uses realmedia.channel4.com to serve the ads or does you xml file no longer exist?