I used this one.
wget http://cachevideos.com/sites/default/files/pub/youtube_cache/youtube_cache-1.2.tar.gzMake sure you got all the requirements.
1. Squid >= 2.6
2. Python >= 2.4
3. Python-urlgrabber (urlgrabber module of python)
4. Python-iniparse (iniparse module of python)
5. Lighttpd Web Server
For the iniparse there is nothing on the repositories you can download it here: http://code.google.com/p/iniparse/
After downloading extract it, on the terminal type:
sudo python setup.py install
Extract the youtube_cache-1.2.tar.gz archive if you haven't done so already.
Open the setup.py file from youtube cache and make this changes to the following entries
squid_user = 'proxy'
squid_group = 'proxy'
Create a dummy folder apache just don't want to get any errors with the install
apache_conf_dir = '/etc/apache2/conf.d/'
save it and type:
sudo python setup.py installedit your squid conf file
sudo gedit /etc/squid/squid.conf
Paste the following at the end of the file:
url_rewrite_program /usr/bin/python /etc/squid/youtube_cache/youtube_cache.py
url_rewrite_children 10
acl youtube_query url_regex -i \.youtube\.com\/get_video
acl youtube_query url_regex -i \.cache[a-z0-9]?[a-z0-9]?[a-z0-9]?\.googlevideo\.com\/videoplayback
acl youtube_query url_regex -i \.cache[a-z0-9]?[a-z0-9]?[a-z0-9]?\.googlevideo\.com\/get_video
acl youtube_deny url_regex -i http:\/\/[a-z][a-z]\.youtube\.com
acl metacafe_query dstdomain v.mccont.com
acl dailymotion_query url_regex -i proxy\-[0-9][0-9]\.dailymotion\.com\/
acl google_query dstdomain vp.video.google.com
acl redtube_query dstdomain dl.redtube.com
acl xtube_query url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv
acl vimeo_query url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/
acl wrzuta_query url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]?
url_rewrite_access deny youtube_deny
url_rewrite_access allow youtube_query
url_rewrite_access allow metacafe_query
url_rewrite_access allow dailymotion_query
url_rewrite_access allow google_query
url_rewrite_access allow redtube_query
url_rewrite_access allow xtube_query
url_rewrite_access allow vimeo_query
url_rewrite_access allow wrzuta_query
redirector_bypass on
edit /etc/youtube_cache.conf
change the base_dir to /var/www/video_cache
IMPORTANT: change cache_host = IPADDRESS of the PROXY
cache_host = 192.168.219.203
sudo cp -r /var/spool/squid/video_cache /var/www/
make sure you can access this folder from http://localhost/video_cache
otherwise the cached flv files won't get served.
restart your squid and apache
sudo /etc/init.d/squid restart
sudo /etc/init.d/lighttpd restart
Configure the browsers to use your proxy and you can check if its working by typing
sudo tail -f /var/log/squid/youtube_cache.logIf it is working correctly after watching a video and trying to watch it again you should see something like this on the log file.
DOWNLOAD YOUTUBE 10167389 Video was downloaded and cached.
CACHE_SERVE YOUTUBE Video was served from cache.
Hope you get it to work too, those damn kids and their videos bahhh!!!

4 comments:
Thanks you very much for writing the howto :) I have linked it from the home page of cachevideos.com :)
I don't think copying the video cache over is a good idea.
Instead, insert this into your lighttpd.conf file
$HTTP["remoteip"] =~ "127.0.0.1" {
alias.url += ("/video_cache" => "/var/spool/video_cache")
}
or for public use,
alias.url += ("/video_cache" => "/var/spool/video_cache")
A new version of youtube cache is available now. It handles caching from 10 websites. Please check http://cachevideos.com/.
Is there a way to update the current installation or do I have to remove it first?
Post a Comment