Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # edited by suprianto_clg@yahoo.com
- # https://www.facebook.com/supri.anto.353
- use LWP::Simple;
- use CGI qw/unescape/;
- #### var
- use IO::File;
- #$|=1;
- $timenow="";
- STDOUT->autoflush(1);
- $debug=1; ## recommended:0
- $bypassallrules=0; ## recommended:0
- $sucks=""; ## unused
- $sucks="sucks" if ($debug>=1);
- my $logfile = '/tmp/storeid.log';
- open my $logfh, '>>', $logfile
- or die "Couldn't open $logfile for appending: $!\n" if $debug;
- $logfh->autoflush(1) if $debug;
- while (<>) {
- chop;
- my $myurl = $_;
- @X = split(" ",$myurl);
- $chan = $X[0]; ## channel id
- $url = $X[1]; ## url
- $ip = $X[2]; ## ip address
- $anbel = $url; ## url
- ##print $logfh "in : $_\n" if ($debug>=1);
- if ($bypassallrules){
- $out="$anbel"; ## map 1:1
- } elsif ($anbel =~ m/^https?:\/\/.*googlevideo\.com\/videoplayback.*(&itag\=([0-9]*)).*(mime\=video).*/) {
- $video = $3;
- $itag = $2;
- $anbel =~ s/$2/itag=133/g;
- print "OK status=302 url=$anbel\n";
- } elsif ($anbel =~ m/^https?:\/\/.*googlevideo\.com\/videoplayback.*(mime\=video).*(&itag\=([0-9]*)).*/) {
- $video = $2;
- $itag = $3;
- $anbel =~ s/$3/itag=133/g;
- print "OK status=302 url=$anbel\n";
- } else {
- print "ERR\n";
- }
- }
- #----------------------------
- #Squid tambahkan
- #helper Force240p
- #----------------------------
- acl ytmimevideo url_regex -i ^https?://.*&itag\=(133|134|135|136)\&.*&mime=video.*
- url_rewrite_program /etc/squid/force240p.pl
- url_rewrite_children 100
- url_rewrite_access allow ytmimevideo
- url_rewrite_access deny all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement