Results 1 to 5 of 5

Thread: Youtube caching using squid

  1. #1
    Join Date
    Aug 2007
    From the land down under
    Ubuntu Development Release

    Youtube caching using squid

    Hey guys,

    is anyone able to convert the following into an ubuntu version/equivalent?

  2. #2
    Join Date
    Feb 2007
    Houston, TX

    Re: Youtube caching using squid

    I tried it and got it to install, here's how:

    Download the source code from

    I used this one.

    Make 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. Apache (httpd) Web Server

    Not sure if it would have worked with lighttpd so I went ahead and used apache2, for the iniparse there is nothing on the repositories you can download it here:

    After downloading extract it, on the terminal type:

    sudo python install

    Extract the youtube_cache-1.2.tar.gz archive if you haven't done so already.

    Open the file from youtube cache and make this changes to the following entries

    squid_user = 'proxy'
    squid_group = 'proxy'
    apache_conf_dir = '/etc/apache2/conf.d/'

    save it and type:

    sudo python install

    edit 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/
    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
    acl dailymotion_query url_regex -i proxy\-[0-9][0-9]\.dailymotion\.com\/
    acl google_query dstdomain
    acl redtube_query dstdomain
    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

    restart your squid and apache

    sudo /etc/init.d/squid restart

    sudo /etc/init.d/apache2 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.log

    Hope you get it to work too, those damn kids and their videos bahhh!!!

    It works with lighttpd also, make sure you can access http://localhost/video_cache otherwise the flv files that are in the cache won't get served.
    Last edited by fujikofujio; November 12th, 2008 at 05:15 AM.

  3. #3
    Join Date
    Feb 2009

    Re: Youtube caching using squid


    any update for this how-to on debian/ubuntu that supports the new version of videcocache 1.9 ?

    your help is highly appreciated


  4. #4
    Join Date
    Aug 2010

    Re: Youtube caching using squid

    i just got into it and the reason that no one is doing anything about it i saw something intresting..
    my ISP i using a bunch of squid servers and... nginx webserver as a LOCAL cache storage.
    from what i have seen it's mainly for ms updates but im looking for a way to buid something free \opensource based that will work and maybe with api and stuff...

  5. #5
    Join Date
    Apr 2011

    Re: Youtube caching using squid


    Is videocache a free product?

    No I think.

    is there any other tweaking possible with squid ?

    with Ubuntu 9.10 squid available version via apt repos is 3 , which is not capable of caching youtube as i read.

    Googling directs me to caching with squid 2.7STABLE9, with some changes.

    But none worked so far



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts