#!/usr/bin/perl $|=1; while (<>) { @X = split; $url_ = $X[0]; if($url_ =~ /^(\d+)/) { $tag = $url_." "; $url_ = $url = $X[1]; } else { $url = $url_; $tag = ""; } if ($url =~s@^http://(.*/videoplayback\?.*redirect=yes&.*)@http://$1@){} elsif ($url =~s@^http://(.*)/videoplayback\?(.*)&id=([a-zA-Z\d\-_]+)&.*(&range=\d*-\d*)&.*@squid://videos.youtube.INTERNAL/ID=$3$4@){} elsif ($url =~s@^http://(.*)/videoplayback\?(.*)&id=([a-zA-Z\d\-_]+)&.*@squid://videos.youtube.INTERNAL/ID=$3@){} elsif ($url =~s@^http://(.*)\.ytimg\.com\/(.*)@squid://ytimg.INTERNAL/ID=$2@){} elsif ($url =~s@^http://(.*)/videoplay\?(.*)&id=([a-zA-Z\d\-_]+)&.*(&range=\d*-\d*)&.*@squid://videos.youtube.INTERNAL/ID=$3$4@){} elsif ($url =~s@^http://(.*)/videoplay\?(.*)&id=([a-zA-Z\d\-_]+)&.*@squid://videos.youtube.INTERNAL/ID=$3@){} elsif ($url =~s@^http://(.*)/videoplay\?(.*)&id=([a-zA-Z\d\-_]+)$@squid://videos.youtube.INTERNAL/ID=$3@){} elsif ($url =~s@^http://(.*)/get_video\?(.*)video_id=([a-zA-Z\d\-_]+)&.*@squid://videos.youtube.INTERNAL/ID=$3@){} elsif ($url =~s@^http://(.*)/get_video\?(.*)video_id=([a-zA-Z\d\-_]+)@squid://videos.youtube.INTERNAL/ID=$3@){} elsif ($url =~s@^http://(.*)rapidshare(.*)/files/(.*)/(.*)/(.*)@squid://files.rapidshare.INTERNAL/$5@){} elsif ($url =~s@^http://(.*)fbcdn\.net\/(.*)\/([sp]200x200)/([a-zA-Z\d\-_]*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4)@squid://files.facebook.INTERNAL/sz$4.$5@){} elsif ($url =~s@^http://(.*)fbcdn\.net\/(.*)\/([sp]\d*x\d*/[a-zA-Z\d\-_]*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4)@squid://files.facebook.INTERNAL/$3.$4@){} elsif ($url =~s@^http://(.*)fbcdn\.net\/(.*)\/(.*)/([a-zA-Z\d\-_]*)\.(jpg|jpeg|gif|png|ico|mp3|flv)@squid://files.facebook.INTERNAL/$4.$5@){} elsif ($url =~s@^http://(.*)fbcdn\.net/(.*)\/([a-zA-Z\d\-_]*)\.(jpg|jpeg|gif|png|ico|mp3|flv)@squid://files.facebook.INTERNAL/$3.$4@){} elsif ($url =~s@^http://(kh|mt)(.*)\.google\.com/(.*)\/(.*)(&s=.*)@squid://$1.google.maps.INTERNAL/$3/$4@){} elsif ($url =~s@^http://(kh|mt)(.*)\.googleapis\.com/(.*)\/(.*)(&s=.*)@squid://$1.googleapis.maps.INTERNAL/$3/$4@){} elsif ($url =~s@^http://st(.*)\.userapi\.com/(.*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4)@squid://userapi.com.INTERNAL/$2.$3@){} elsif ($url =~s@^http://contenidos2(.*)/(.*)@squid://files.contenidos2.INTERNAL/$2@){} elsif ($url =~s@^http://cdn(.*)/([0-9a-zA-Z_-]*?\.flv)@squid://files.cdn.INTERNAL/$2@){} elsif ($url =~s@^http://web.vxv.com/data/media/(.*)@squid://files.vxv.INTERNAL/$1@){} elsif ($url =~s@^http://ecn\.dynamic\.t(\d*).tiles\.virtualearth\.net\/comp/ch/(.*)@squid://bing.maps.INTERNAL/$2@){} elsif ($url =~s@^http://(.*)megaupload\.com/files/(.*)/(.*)@squid://files.megaupload.INTERNAL/$3@){} elsif ($url =~s@^http://(.*)mediafire\.com/(.*)/(.*)@squid://files.megaupload.INTERNAL/$3@){} elsif ($url =~s@^http://(.*)depositfiles\.com/(.*)/(.*)/(.*)@squid://files.megaupload.INTERNAL/$4@){} elsif ($url =~s@^http://(.*)\.files\.youporn\.com\/(.*)\/([0-9a-zA-Z_-]*?\.flv)\?.*@squid://videos.youporn.INTERNAL/$3@){} elsif ($url =~s@^http://(.*)\.files\.youporn\.com\/(.*)\/([0-9a-zA-Z_-]*?\.flv)@squid://videos.youporn.INTERNAL/$3@){} elsif ($url =~s@^http://(.*)\.tube8\.com\/(.*)\/([0-9a-zA-Z_-]*?\.flv)\?.*@squid://videos.tube8.INTERNAL/$3@){} elsif ($url =~s@^http://(.*)\.tube8\.com\/(.*)\/([0-9a-zA-Z_-]*?\.flv)@squid://videos.tube8.INTERNAL/$3@){} elsif ($url =~s@^http://(.*)megaporn\.com\/files\/(.*)\/(.*)@squid://files.megaporn.INTERNAL/$3@){} elsif ($url =~s@^http://static\.video\.yandex\.ru\/swf\/.*&r=(\d*).*@squid://video.yandex.INTERNAL/$1@){} elsif ($url =~s@^http://vec0\d\.maps\.yandex\.net\/tiles\?l=map&v=([\d\.]*)&x=(\d*)&y=(\d*)&z=(\d*)&g=.*@squid://vec.yandex.INTERNAL/l=map&x=$2&y=$3&z=$4&lang=uk_UA@){} elsif ($url # =~s@^http://vec0\d\.maps\.yandex\.net\/tiles\?l=map&v=([\d\.]*)&x=(\d*)&y=(\d*)&z=(\d*)&lang=(.*)@squid://vec.yandex.INTERNAL/l=map&v=$1&x=$2&y=$3&z=$4&lang=$5@){} =~s@^http://vec0\d\.maps\.yandex\.net\/tiles\?l=map&v=([\d\.]*)&x=(\d*)&y=(\d*)&z=(\d*)&lang=(.*)@squid://vec.yandex.INTERNAL/l=map&x=$2&y=$3&z=$4&lang=$5@){} elsif ($url =~s@^http://\d+\.pvec\.maps\.yandex\.net\/(.*)@squid://pvec.yandex.INTERNAL/$1@){} elsif ($url =~s@^http://static\.video\.yandex\.net\/(.*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4|wmw|avi|mpg|mpeg)\?*.*@squid://static.video.yandex.yandex.INTERNAL/$1.$2@){} #static.video.yandex.net/get/mutabor-666/hcmcb7t0qk.7036/1.m450x334.jpg elsif ($url =~s@^http://video\.meta\.ua\/players\/video\/.*fileID=([\da-zA-Z]*)&.*@squid://video.meta.ua.INTERNAL/$1@){} elsif ($url =~s@^http://s\d+\.dotua\.org\/fsua_items(.*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4)@squid://dotua.org.INTERNAL/fsua/$1.$2@){} elsif ($url =~s@^http://img\d+.slando\.ua\/(.*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4)@squid://img.slando.ua.INTERNAL/$1.$2@){} elsif ($url =~s@^http://(.*)\.s\d*\.staticclassifieds\.com\/static(.*)@squid://staticclassifieds.com.INTERNAL/$1/$2@){} elsif ($url =~s@^http://(st|cs)\d+\.vk\.me\/(.*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4).*@squid://$1.vk.me.INTERNAL/$2.$3@){} elsif ($url =~s@^http://video\d*\.vkadre\.ru\/assets\/(.*)\.(jpg|jpeg|gif|png|ico|mp3|flv|mp4)@squid://vkadre.ru.INTERNAL/$1.$2@){} print $tag.$url."\n"; open(H_IPFW, ">>", "/usr/local/squid/logs/rewrite.log"); print H_IPFW $url_." # ".$url."\n"; close(H_IPFW); }