Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # CONTENT OF STORE-ID
- # final working store-id http-https youtube
- # squid.conf http://pastebin.com/YrBPzaDs
- # send link from youtube contain >> (ptracking|stream_204|player_204|gen_204) to storeurl
- $|=1;
- while (<>) {
- @X = split;
- if ( $X[0] =~ m/^http\:\/\/.*/) {
- $x = $X[0];
- $_ = $X[0];
- $u = $X[0];
- } else {
- $x = $X[1];
- $_ = $X[1];
- $u = $X[1];
- }
- if ($x =~ m/^http(|s)\:\/\/.*youtube.*(ptracking|stream_204|player_204|gen_204).*(video_id|docid|v)\=([^\&\s]*).*/){
- $vid = $4 ;
- @cpn = m/[&?]cpn\=([^\&\s]*)/;
- $fn = "/var/log/squid/@cpn";
- unless (-e $fn) {
- open FH,">".$fn ;
- print FH "$vid\n";
- close FH;
- }
- $out = $x ;
- } elsif ($x =~ m/^http(|s)\:\/\/.*(youtube|google).*videoplayback.*/){
- @itag = m/[&?](itag=[0-9]*)/;
- @ids = m/[&?]id\=([^\&\s]*)/;
- @mime = m/[&?](mime\=[^\&\s]*)/;
- @cpn = m/[&?]cpn\=([^\&\s]*)/;
- $fn = "/var/log/squid/@cpn";
- if (-e $fn) {
- open FH,"<".$fn ;
- $id = <FH>;
- chomp $id ;
- close FH ;
- } else {
- $id = $ids[0] ;
- }
- @range = m/[&?](range=[^\&\s]*)/;
- $out = "http://video-srv.youtube.com.SQUIDINTERNAL/id=" . $id . "&@itag@range@mime";
- #} elsif ($x =~ m/^https?:\/\/.*\.akamaihd\.net\/((hphotos|hprofile|hvthumb|hvideo)(-ak-|-)(frc|snc|ash|prn)[0-9])?.*\/(.*)/) {
- #$out="http://fbcdn.net.squid.internal/" . $2 . $3 . $6 ;
- #} elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*fbcdn[\w\d\-\.\%]*net\/safe\_image\.php\?(.*)/) {
- #$out="http://fbcdn.net.squid.internal/" . $1 . "/" . $2 . "/" . $3 ;
- #} elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*fbcdn[\w\d\-\.\%]*net\/rsrc\.php\/(.*)/) {
- #$out="http://fbcdn.net.squid.internal/" . $1 . "/" . $2 . "/" . $3 ;
- #} elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*fbcdn[\w\d\-\.\%]*net\/[\w\d\-\.\%]*\/(.*)/) {
- #$out="http://fbcdn.net.squid.internal/" . $1 . "/" . $2 . "/" . $3 ;
- #} elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*akamaihd[\w\d\-\.\%]*net\/[\w\d\-\.\%]*\/(.*)/) {
- #$out="http://fbcdn.net.squid.internal/" . $1 . "/" . $2 . "/" . $3 ;
- } elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*fbcdn[\w\d\-\.\%]*net\/safe\_image\.php\?(.*)/) {
- $out="http://fbcdn.net.squid.internal/" . $1 ;
- } elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*fbcdn[\w\d\-\.\%]*net\/rsrc\.php\/(.*)/) {
- $out="http://fbcdn.net.squid.internal/" . $1 ;
- } elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*fbcdn[\w\d\-\.\%]*net\/[\w\d\-\.\%]*\/(.*)/) {
- $out="http://fbcdn.net.squid.internal/" . $1 ;
- } elsif ($x =~ m/^https?:\/\/[\w\d\-\.\%]*akamaihd[\w\d\-\.\%]*net\/[\w\d\-\.\%]*\/(.*)/) {
- $out="http://fbcdn.net.squid.internal/" . $1 ;
- #googlechrome
- } elsif ($x =~ m/^http:\/\/[\d\w\-]+\.c\.pack\.google\.com\/.*\/(.*?\.exe)\?.*/) {
- $out="http://googlechrome.squid.internal/" . $1 ;
- } elsif ($x =~ m/^http:\/\/[\d\w\-]+\.c\.pack\.google\.com\/.*\/.*\/(.*?\.crx)\?.*/) {
- $out="http://googlechrome.squid.internal/" . $1 ;
- } elsif ($x =~ m/^http:\/\/i[1-4]\.ytimg\.com\/(.*)/) {
- $out="http://ytimg.com.squid.internal/" . $1 ;
- } elsif ($x =~ m/^http:\/\/.*\.dl\.sourceforge\.net\/(.*)/) {
- $out="http://dl.sourceforge.net.squid.internal/" . $1 ;
- #Speedtest
- } elsif ($x =~ m/^http\:\/\/.*\/speedtest\/(.*\.(jpg|txt)).*/) {
- $out="http://speedtest.squid.internal/" . $1 ;
- #reverbnation
- } elsif ($x =~ m/^http:\/\/c2lo\.(reverbnation)\.com\/(audio)_player\/.*\/(.*)[\/\?]/) {
- $out = "http://reverbnation.squid.internal/" . $1 . "/" . $2 . "/" . $3 ;
- #BLOGSPOT
- } elsif ($x =~ m/^http:\/\/[1-4]\.bp\.(blogspot\.com.*)/) {
- $out="http://blog-cdn." . $1 ;
- #AVAST
- } elsif ($x =~ m/^http:\/\/download[0-9]{3}.(avast.com.*)/) {
- $out="http://avast-cdn." . $1 ;
- #AVAST
- } elsif ($x =~ m/^http:\/\/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\/(iavs.*)/) {
- $out="http://avast-cdn.avast.com/" . $1 ;
- #KAV
- } elsif ($x =~ m/^http:\/\/dnl-[0-9]{2}.(geo.kaspersky.com.*)/) {
- $out="http://kav-cdn." . $1 ;
- #AVG
- } elsif ($x =~ m/^http:\/\/update.avg.com/) {
- $out="http://avg-cdn." . $1 ;
- #maps.google.com
- } elsif ($x =~ m/^http:\/\/(cbk|mt|kh|mlt|tbn)[0-9]?(.google\.co(m|\.uk|\.id).*)/) {
- $out="http://" . $1 . $2 ;
- #maps.google.com
- } elsif ($x =~ m/^http:\/\/(kh|mt)[0-9]?(.google.com.*)/) {
- $out="http://" . $1 . $2 ;
- #Google
- } elsif ($x =~ m/^http:\/\/(.*\.google-analytics\.com)\/(__utm\.gif)\?.*/) {
- $out="http://google-analytics.com.squid.internal/" . $1 . $2 ;
- } elsif ($x =~ m/^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*?)/) {
- $out="http://" . $1 ;
- #cdn, varialble 1st path
- } elsif (($x =~ /filehippo/) && (m/^http:\/\/(.*?)\.(.*?)\/(.*?)\/(.*)\.([a-z0-9]{3,4})(\?.*)?/)) {
- @y = ($1,$2,$4,$5);
- $y[0] =~ s/[a-z0-9]{2,5}/cdn./;
- $out="http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] ;
- #rapidshare
- } elsif (($x =~ /rapidshare/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?)([a-z]*\.[^\/]{3}\/[a-z]*\/[0-9]*)\/(.*?)\/([^\/\?\&]{4,})$/)) {
- $out="http://cdn." . $3 . "/squid.internal/" . $5 ;
- #domain/path/.*/path/filename
- } elsif (($X[1] =~ /fucktube/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?[^\/]*\/[^\/]*)\/(.*)\/([^\/]*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
- @y = ($1,$2,$4,$5,$6);
- $y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
- $out="http://" . $y[0] . $y[1] . "/" . $y[2] . "/" . $y[3] . "." . $y[4] ;
- #youjizz. We use only domain and filename
- } elsif (($X[1] =~ /media[0-9]{1,5}\.youjizz/) && (m/^http:\/\/(.*?)(\.[^\.\-]*?\.[^\/]*)\/(.*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})(\?.*?)$/)) {
- @y = ($1,$2,$4,$5);
- $y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^\.]*cdn[^\.]*)|([^\.]*cache[^\.]*))/cdn/;
- $out="http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] ;
- #general purpose for cdn servers. add above your specific servers.
- #} elsif (m/^http:\/\/([0-9.]*?)\/\/(.*?)\.(.*)\?(.*?)/) {
- #$out="http://squid-cdn-url/" . $2 . "." . $3 ;
- #generic http://variable.domain.com/path/filename."ex", "ext" or "exte"
- #http://cdn1-28.projectplaylist.com
- #http://s1sdlod041.bcst.cdn.s1s.yimg.com
- } elsif (m/^http:\/\/(.*?)(\.[^\.\-]*?\..*?)\/([^\?\&\=]*)\.([\w\d]{2,4})\??.*$/) {
- @y = ($1,$2,$3,$4);
- $y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn)[-\d]*)|([a-zA-A]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
- $out="http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] ;
- #for yimg.com video
- } elsif ($x =~ m/^http:\/\/(.*yimg.com)\/\/(.*)\/([^\/\?\&]*\/[^\/\?\&]*\.[^\/\?\&]{3,4})(\?.*)?$/) {
- $out="http://cdn.yimg.com/" . $3 ;
- #for yimg.com doubled
- } elsif ($x =~ m/^http:\/\/(.*?)\.yimg\.com\/(.*?)\.yimg\.com\/(.*?)\?(.*)/) {
- $out="http://cdn.yimg.com/" . $3 ;
- #for yimg.com with &sig=
- } elsif ($x =~ m/^http:\/\/([^\.]*)\.yimg\.com\/(.*)/) {
- @y = ($1,$2);
- $y[0] =~ s/[a-z]+([0-9]+)?/cdn/;
- $y[1] =~ s/&sig=.*//;
- $out="http://" . $y[0] . ".yimg.com/" . $y[1] ;
- # all that ends with ;
- } elsif (m/^http:\/\/(.*?)\/(.*?)\;(.*)/) {
- $out="http://" . $1 . "/" . $2 ;
- } else {
- $out=$x;
- }
- if ( $X[0] =~ m/^http\:\/\/.*/) {
- print "OK store-id=$out\n" ;
- } else {
- print $X[0] . " OK store-id=$out\n" ;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement