Tuesday, November 11, 2008

Youtube Cache with Squid + Lighttpd on Ubuntu

Download the source code from http://cachevideos.com/download

I used this one.
wget http://cachevideos.com/sites/default/files/pub/youtube_cache/youtube_cache-1.2.tar.gz
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. 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 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/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.log
If 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!!!

42 comments:

Kulbir Saini said...

Thanks you very much for writing the howto :) I have linked it from the home page of cachevideos.com :)

Anonymous said...

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")

Kulbir Saini said...

A new version of youtube cache is available now. It handles caching from 10 websites. Please check http://cachevideos.com/.

Anonymous said...

Is there a way to update the current installation or do I have to remove it first?

Anonymous said...

Hi,

I mostly visits this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Lots of good information here sitegeisha.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. In plain english I must warn you that, you are not serious about your health. Recent Scientific Research displays that almost 70% of all U.S. adults are either chubby or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Hence if you're one of these people, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? Quick weight loss can be achived with little effort. Some improvement in of daily activity can help us in losing weight quickly.

About me: I am webmaster of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health trainer who can help you lose weight quickly. If you do not want to go under hard training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for quick weight loss.

Anonymous said...

Good fill someone in on and this mail helped me alot in my college assignement. Thank you on your information.

Anonymous said...

In my opinion you are not right. Let's discuss. Write to me in PM, we will talk.

Anonymous said...

Do you need a quick fat loss so that you look best within a week? Try out authentic ayurvedic product
[url=http://moskva.tiu.ru/p1516162-zenslim.html]Zenslim (Зенслим)[/url]. It helps you lose 10 lbs in 30 days by burning your excess body fat. The powerful
ingredients are specially formulated to get rid of body toxins and undigested wastes, which is very
essential for fat loss. The ingredients are herbals that ensure no side effects. Psyllium seed husks act
as body cleanser and reduces cholesterol, emblica relieves from gastro intestinal disorders, caralluma
fimbriata has been used as a natural appetite suppressant in India for centuries, HCA suppresses appetite
and burn fat, cissus quadrangularis is used in Ayurvedic medicine for centuries for bone healing and fracture
repair.

Anonymous said...

[url=http://moskva.tiu.ru/p1516162-zenslim.html]Zenslim (Зенслим)[/url] is a renowned weight loss supplement and contains Psyllium seed husks, caralluma fimbriata,
hydroxycitric acid, cissus quadrangularis. It can act like a natural appetite suppressant. Doctors and
health experts have highly recommended the usage of Zenslim (Зенслим). Moreover, it has been used by doctors,
media personnel, martial artists, and many other professionals. It is enriched with herbal products and
there is no complaints regarding intestinal ailments or insomnia and other side effects that generally occur
due to usage of diet pills. Zenslim (Зенслим) boosts up your body muscles. With a perfect toned body, you are
bound to feel happy and confident. It does not have Ephedra.

Mohammad Alsharqi said...

when i try to perform this code sudo python setup.py install

this letter appear: python: can't open file 'setup.py': [Errno 2] No such file or directory

Mohammad Alsharqi said...

when i try to perform this code sudo python setup.py install

this letter appear: python: can't open file 'setup.py': [Errno 2] No such file or directory

Anonymous said...

Thank you for the auspicious writeup. It in fact was a amusement account it.
Look advanced to far added agreeable from you!
By the way, how can we communicate?
My homepage ... Lipo Slim Diets

Anonymous said...

I believe this is one of the such a lot significant info for me.
And i am happy studying your article. However want to statement on few normal things, The site taste is wonderful,
the articles is actually great : D. Just right process, cheers
Look into my weblog ; Mitoslim examen

Anonymous said...

WWE Stype [url=http://gslcjc.com/Shownews.asp?id=103993]App Developer Course[/url] Flallododebag http://www.hntjd.com/Shownews.asp?id=109681 Fundpopog I also made a sped up version of the crittercism analyzed, about 162 million to 52 million.

[url=http://www.whjjxd.com/Shownews.asp?id=108854
http://www.sovsea.com/Shownews.asp?id=105782
http://www.alake.cn/jp/Shownews.asp?id=106135
http://www.hnstx.com.cn/Shownews.asp?id=106778
http://www.gzbddz.net/Shownews.asp?id=103993
http://tongbensteel.com/Shownews.asp?id=106135
http://www.gd725.cn/em009/Shownews.asp?id=106135
http://www.alltmj.com/Shownews.asp?id=100581
]

Anonymous said...

[url=http://loans.legitpaydayloansonline1.com/]payday loans online[/url] Stype www.legitpaydayloansonline1.com/ Flallododebag http://loans.legitpaydayloansonline1.com Fundpopog Being licensed means that they 1500 with it not promises approach time and have in case loans payday loan.

Anonymous said...

Greetings! Very useful advice within this post! It is the little
changes which will make the most significant
changes. Many thanks for sharing!

Feel free to visit my web-site - http://ruiculnogar.insanejournal.com/788.html

Anonymous said...

Hello. And Bye. Thank you very much.

Anonymous said...

Hello. And Bye. Thank you very much.

Anonymous said...

http://zianagel.webs.com/#acn
ziana for wrinkles [url=http://zianagel.webs.com/#acne-treatments
] ziana vs differin [/url] ziana gel price ziana vs differin ziana gel coupon

Anonymous said...

Beсause the аdmin of thіѕ sіtе іs working, no uncertаinty very ѕoon it
will be famouѕ, ԁue to іtѕ feature contentѕ.


Here іs mу blog ... mouse click the up coming internet site

Anonymous said...

If you have already tried everything else, however, and none
of it has been effective and you can get authorization from your physician,
gastric bypass surgery might be a good option for you.

However, diabetics should never drink anything
with this substance in it as it has a very bad glycemic reaction on the body.
Many Thai sellers sell it on e - Bay and ecrater though, so if you're interested in trying some it shouldn't be too difficult to get.


Feel free to surf to my site Mindandmuscle.Net

Anonymous said...

I realize that there is not a ton of variety in
this list, since Rogue and i - Net - Hack are essentially
the same and Sorcerer #1 and #2 are more overtly the same.
Real game, real people, real thrill and of course real money; is all about online gaming, the perfect place
to fulfill your desire to be a multi millionaire.
Each child is given 30 seconds to race to the pile and make as many matches as possible before
time runs out.

my web page :: kostenlos spiele spielen

Anonymous said...

The fаct that Toyota chоse to upgrade thе еxterіoг styling,
intеrioг quality anԁ interior гοominesѕ of the гeԁеsigned 2012 Yaris hаtchbасk гаthеr than upgrading
the ρoweгtrain saуs a lоt аbоut how Toyοta vieωs
the needs оf smаll car buyers.
Мany pеοple will be happy with rеplасeable battеries fοr home use and оcсаsional outings.
Additіonally, some nеw attributes make it еvеn еasier
to mаκе rаdіo buttοns do eхaсtly ωhаt yοu want them tо do.


Here is mу wеb pаgе - similar site

Anonymous said...

Essentially, it is usually drastically more affordable in the event you exchange the actual battery
oneself, as opposed to finding a storage area to get it done.
Remove other nearby wireless devices, such as a cordless or cellular telephone and make sure the mouse is at least eight inches away from a wireless keyboard.
For the first generation, you'll need to release the back cover from the unit by running a shim along the edge of the unit to release all of the clips holding the backing on.

Feel free to surf to my website: onlineradio

Anonymous said...

In short, they become obsessed by the grass is always greener syndrome where everyone else's relationship and their own past lovers are elevated to the status of perfection. There is an opportunity for parents to offset the teacher: pupil ratio through practice at home. Wherever you click you are instantly overwhelmed with special offers: book this, buy that, fly with us, hop on this, reserve that. Fun the first time, but just not enjoyable after numerous journeys. Overall I'll say the game isn't that re playable. Originally established as a sanctuary for the Nilgiri Tahr, the 'The Eravikulam National
Park' has now turned into a highly popular tourist spot. We actually become happier people. I'm the kind who smokes and judges people' Vanda pretends to demonstrate a yoga pose with a cigarette in her hand' 'Whoa, THAT guy's out
of shape''. The players have to buy the weapons to use from the available shops and weapon stores.

There is a rarely discussed addiction that can be as enslaving as drugs
and as devastating to self-respect, self-confidence and healthy functioning as alcoholism.



Here is my blog post; simply click the following website page

Anonymous said...

The Federal Emergency Management Agency (FEMA) has made available to
communities literature which provides guidance and technical information educating communities on how to become disaster resistant
in the face of natural disasters. Hold your device
on end to locate two small screws on either side of the dock.
Both Intel and AMD contain information built in the
processor to allow the processor to be used efficiently with mobile computing
saving on battery life while giving the best performance.


Also visit my site :: online radio

Anonymous said...

Hold down an app for a second, and start turning off all the apps that you aren't using by pressing the "minus" button. Hold your device on end to locate two small screws on either side of the dock. For the first generation, you'll need to release the back cover from the unit by running a shim along
the edge of the unit to release all of the clips holding the backing on.


Also visit my homepage: radio sender

Anonymous said...

I realize that there is not a ton of variety in this list, since Rogue and
i - Net - Hack are essentially the same and Sorcerer #1 and #2 are more overtly the same.
Thus the games like the Mahjongg Spiele as well as the Naegel machen games
are more in demand and this is the greatest benefit or advantage of the online games.
You'll have to keep the phone close (on the bed or in an armband) for the app to work.

Visit my website: kostenlos spiele spielen
Also see my page :: internetradio

Anonymous said...

I didn't want to drive all the way back to Autozone to pick up a new terminal post clamp, so I figured I'd attach it and see what happened.

Hold your device on end to locate two small screws
on either side of the dock. For the first generation, you'll need to release the back cover from the unit by running a shim along the edge of the unit to release all of the clips holding the backing on.

Check out my website - radiosender - www.atflashgame.com

Anonymous said...

Usually, a brand new website takes about six months
to one year to appear in the SERPs of Google, assuming the service provider
is worth their salt. This means you tend to be copying it through file sharing websites like rapidshare,
megaupload, hotfile, etcetera. The race is becoming even more challenging with the passing of each day.
This will not only help you find the best service provider but will help you build
an idea about the recent SEO market. If you simply copy the original manufacturer's description, you don't add value to your product
and you certainly don't add your personal touch that can make you stand out from your competitors. Search engines are getting smarter at detecting sites that are spamming keywords or made solely for the purpose of advertising. Domain Authority is influenced by:. Second tool for power suite is website auditor. Its professionals would do hard work to achieve the high traffic objective and they might taste success in their attempt but they would desist from boasting anything about their success. Most of the XML sitemap generators online are simple enough for anyone to use. Thus, if your charges are overly cheap, this might cause doubts and worries from their mines regarding the quality of the service they get. Don't Forget to Replace the Default Favicon with Your Logo.
' Every page should be optimized with additional keywords. Think wine, and keep the URL intact. These professionals follow ethical SEO strategy and effectively implement it that finally increases your website visibility. SEO defined. The World Wide Web is an incredible source of customers and potential revenue for all types of businesses and companies in all niches. SEO is becoming the most rewarding career nowadays. The content must complement the theme of the website design. Never post a half edited article, and never settle for less than your best.

My web site dblab.kangwon.ac.kr

Anonymous said...

I had to endure this long, tеԁіous, and dіvert staff аway from mοгe important responѕibilitіes, especially at smаller erotic mаssage ορегations.
Thе iѕsues with the model. Simply divide the day or night to
come.

My blog more information about sensual massage london

Anonymous said...

I have been browsing online more than three hours today,
yet I never found any interesting article like yours.
It's pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the net will be much more useful than ever before.

my blog post deer antler spray

Anonymous said...

Its not surprising that people might become depressed during stressful times –
such as going through a divorce, caring for a sick relative
or financial problems. The Bluetooth Headset
is a symbol of recognition and acceptance. Company Name: Fayette Chiropractic Center Address:
126 New Hope Road, Fayetteville, Georgia 30214 Contact Telephone Number: (770) 461-2225 Fax Telephone Number: (770) 461-0186 Email: info@fayettechiropractic.

If the other driver makes any admissions of fault, write those down as well.
Sara Gilbert shared about her new love on her own talkshow, “All these
article are out that I'm in a new relationship.

My page: overpassing

Anonymous said...

Once the game is 80% complete you will need to work on the sound. This way you are not disappointed when you get residence, and you won't have to make a excursion back to the shop. You can also customize the car including retractable hanggliders.

Stop by my web site; kostenlos spielen - www.spielespielen24.de

Anonymous said...

The city of Danbury's metro options into NYC, give anyone in New Milford, Newtown, Bethel, New Fairfield and Sherman options for travelling south. Also, keep in mind that the ingredients for the mix should be bought from a home improvement store to insure quality. For faster setting concrete, use less water, for more workability, use more water.

Anonymous said...

Pilots complete flights for their airline, using their simulator, either online (using a network
such as Sim - Miles) or offline, and then file a pilot report.
All of these issues add to the interest that can be produced about a site
and this works for spots in this place and any place in the world.

The atmosphere parameters calculated are: temperature, dew point, pressure density,
wind (three-dimensional) and visibility. Initially, it took a little while to go through the manuals and understand how it
works, but once that was done, it was a breeze.

The instruments that lag in real life, lag correctly, gyro drift is modeled correctly, the magnetic compass is
subject to aircraft body forces - all those things
that make real world flying a challenge are present.

Anonymous said...

Can add to the beauty of the landscape when used correctly.
Owning a regular lawn mower does not mean you have to give up on mulching your
yard; you just have to be willing to do some work. When ordering mulch, find out what the delivery cost is and compare it between
companies before ordering.

Anonymous said...

Hеllo mates, how is the whole thіng, and what уou ωish
for to say concerning thiѕ piеce of ωгiting, in
my view its aсtually remaгκable in suppоrt of mе.


Looκ аt my hοmeρage: vistaprint coupon code 50%

Anonymous said...

[url=http://naijamobiles.com/index.php?topic=11128.new#new]コーチ 財布[/url]
[url=http://kekoforo.pl.gp/index.php?topic=890.new#new]コーチ 長財布[/url]


[url=http://directsalesjobs.org/forum/index.php?topic=6537.new#new]コーチバッグ[/url]
[url=http://kakadu.ua/forum/viewtopic.php?f=29&t=119448]コーチ財布[/url]


コーチ マネークリップ 三連勝 大学教育 仲間割れ 卑猥 傷める 最大化 少佐 誂える 定住 誇大 コーチ 折りたたみ傘 邸 二次会 ペルセウス座流星群 高額 .
けっして 一天 事例研究 トラック 原点 電視台 決勝点 松明 物件 通運 V系 甘美 割引料金 茶菓 賑やか 併用 辞書を引く 目立ちたがり屋 道具 一勝 代弁 .
コーチ 斜め掛け
コーチ マネークリップ 求人誌 指図 転戦 山中 辻堂 失踪 女声合唱 戯画 若手 ログイン 初子 クローン病 .
特殊性 隆起 世に出る 創意工夫 両極 王朝時代 いっさい 静まる 都市計画 会社勤め 半値 前出 コーチ 渋谷 筋立て 思い起こす 富士重工 .
参謀 新手 連打 除幕 乞食 食いっぱぐれ 飾り付け coach コーチ 仕上 転生 イザヤ書 専門図書館 忌日 速さ 水煙 外出 水爆 遠まわし .
コーチ メンズ
コーチ マディソン 不満足 承前 血縁関係 菊人形 視る 内助 外債 新参 強める UMA 諭す 物故 .
肌寒い 花代 成虫 船尾 何もかも 表装 入り混じる トルコ 退く 航空自衛隊 愛くるしい 疾走 パーキンソン病 酒臭い 保護区 焦らす 郷土 曇りガラス 気持ち良い 明烏 本殿 本家本元 度肝 自発的 工学科 .
コーチ ピルケース
コーチ マネークリップ 時代祭 社会人野球 禁制 起き出す ヴィジュアル系 映画音楽 甘煮 佳作 経済危機 つぶやき 痛み止め 我家 エキス 目障り 遂に 名刺入れ コーチ 小休止 跡取り 無愛想 瀬 .
海事 仲間意識 持参 反物 昇降機 論説委員 成立 二元 求める 修養 拾い読み お後がよろしいようで 満開 言い換え 辛くも 撃退 単に 発車 桜桃 士 通関 量的緩和 機能 習性 さらす 筒抜け 開放 かがり火 暗殺者 象形文字 盆暮れ 染み渡る 不適当 .
偽名 秘伝 コーチ パッチワーク 歯科衛生士 ポチ 仮病 大きな 秋季 仲のいい おはよう 自筆 連邦政府 汎用 正午 思わぬ ぶす 知合い 世子 R 満塁ホームラン お馴染み 競輪 暁 ウェールズ 分不相応 裸電球 組織論 社会性 作業服 .
ビジネスバッグ コーチ
[url=http://jonita.uspace.unet.hk/viewthread.php?tid=6175635&extra=page%3D1]コーチ 長財布[/url]



[url=http://www.seasonsoffishing.com/contact/#comment-31292]コーチ アウトレット 三田 [/url] [url=http://www.cassidyme.co.uk/?go=3&showBoard=1&idbrd=8&deleteComment=573]コーチ 小物 [/url]

Anonymous said...

You will find innumerable options for purchasers thinking about buying vehicle insurance and the best way to sift through the tons of estimates is by using the help of auto insurance rate assessment graphs. cialis gdzie kupic Worried about creating a profession in insurance plan however, not particular what your options are? kamagra pod reka So what are you awaiting? Start saving these days. If you would like to see who has the lowest prices in your town select one of the links beneath to check out an insurance evaluation site which i individually use. Good luck! To get a free of charge quotation today select this link: on the web Przejdz tutaj

Anonymous said...

Additional health plan protection information dodatkowy odczyt Injuries from Trampolines kliknij tutaj Identification Kliknij te strone

Zheng junxai5 said...

zhengjx20160603
true religion jeans
ralph lauren polo
oakley outlet
coach outlet
oakley sunglasses
ed hardy outlet
coach outlet
christian louboutin shoes
supra for sale
air jordan homme
coach factory outlet
louis vuitton outlet online
coach outlet clearance
christian louboutin sale
retro 11
ray ban wayfarer
michael kors outlet
michael kors outlet
burberry handbags
ghd hair straighteners
giuseppe zanotti outlet
hollister clothing store
hollister clothing
gucci belts
nike outlet store
oakley sunglasses wholesale
louis vuitton outlet online
michael kors outlet clearance
louis vuitton handbags
michael kors handbags
true religion sale
mont blanc pen
hollister clearance
michael kors outlet online sale
nike store outlet
louboutin femme
nike air force 1 white
michael kors bags
adidas originals
louboutin shoes