Search squid archive

Re: YouTube and other streaming media (caching)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Adrian, Ray and everyone...

Here is a little contribution for the store_url_rewrite script, this
part deals with youtube and google video (At least, it works for
now)...

NOTES:

1) This code is different because is based on the examples for the
url_rewrite_program
(http://wiki.squid-cache.org/SquidFaq/SquidRedirectors) and that way
was easier for me.

2) Warning! This code may match other sites not related to YT or GV.

3) I used "squid://" at the begining of the rewrited string to avoid
matching another rule, I know it's not standard and I'm still hoping
It doesn't cause any problems... Dear developers, please forgive my
insolence... :-)

--------------------
$|=1;
while (<>) {
  @X = split;
  $url = $X[0];
  $url =~ s@^http://(.*?)/get_video\?(.*)video_id=(.*?)&.*@squid://videos.youtube.INTERNAL/ID=$3@;
  $url =~ s@^http://(.*?)/get_video\?(.*)video_id=(.*?)$@squid://videos.youtube.INTERNAL/ID=$3@;
  $url =~ s@^http://(.*?)/videodownload\?(.*)docid=(.*?)$@squid://videos.google.INTERNAL/ID=$3@;
  $url =~ s@^http://(.*?)/videodownload\?(.*)docid=(.*?)&.*@squid://videos.google.INTERNAL/ID=$3@;
  print "$url\n";
}
--------------------

4) This is the relevant part of my squid.conf:

acl store_rewrite_list  url_regex ^http://(.*?)/get_video\?
acl store_rewrite_list url_regex ^http://(.*?)/videodownload\?
cache allow store_rewrite_list

# Had to uncomment this again, because I couln'd login to google mail
using IE6 (firefox had no trouble):
acl QUERY urlpath_regex cgi-bin \?
cache deny  QUERY

refresh_pattern ^http://(.*?)/get_video\? 10080 90% 999999
override-expire ignore-no-cache ignore-private
refresh_pattern ^http://(.*?)/videodownload\? 10080 90% 999999
override-expire ignore-no-cache ignore-private

storeurl_access allow store_rewrite_list
storeurl_access deny  all

storeurl_rewrite_program /usr/local/bin/store_url_rewrite

--------------------

Regards,

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux