Syaifuddin.jw

bingung mau nulis apa

fail over speedy dan smartfrent

speedy “pppoe-out1”
Smartfren “Smart”

{
:local ADSL [:pick [:tostr [:pick [/interface pppoe-client monitor pppoe-out1 as-value] 0] ] 7 10]
:local SMART [:pick [:tostr [:pick [/interface ppp-client monitor Smart as-value] 0] ] 7 10]
:if ($ADSL != “con” ) do={ 
:if ($SMART = “dis” ) do={
/interface ppp-client enable Smart

}
:if ($ADSL = “con” ) do={ 
:if ($SMART != “dis” ) do={
/interface ppp-client disable Smart

}
}

 

youtube versi HC oktober

youtube versi handycache (lua extensi)

–[[ <HCExtension>
@name youtube file cpn
@author Komunitas Handycache Indonesia
@version 1
@description testing purpose only
@rule youtube.com.*?(video_id|docid)
@rule youtube.com/videoplayback.*
@event URLToFileNameConverting/tulis
@event AnswerHeaderReceived/add
</HCExtension> ]]

function add()
local ytpb = re.match(hc.url, [[^.*youtube\.com/videoplayback\?.*]])
if ytpb then
local sv = re.find(hc.answer_header, [[^HTTP/1\.1\s200\sOK]])
local dsv = re.find(hc.url, [[begin=(?!0)[0-9]+]])
if sv and not dsv then
hc.action = ‘save’
hc.monitor_string = ‘Youtube-Saving’
end
if hc.cache_file_size >= 0 then
hc.answer_header = re.replace(hc.answer_header, [[^Server:\s\K[^\r\n]+]], ‘HandyCache’)
hc.action = ‘dont_update’
hc.monitor_string = ‘Youtube-Hit’
end
end
end

function tulis()
if re.match(hc.url, [[.*youtube.*(ptracking|stream_204|player_204|gen_204).*(video_id|docid).*]])
then
local vid = re.find(hc.url, [[(video_id|docid)=[^&]+]])
vid = re.replace(vid, [[(video_id|docid)=([^&]+)]], [[\2]])
local cpn = re.find(hc.url, [[cpn=[^&]+]])
cpn = re.replace(cpn, [[(cpn)=([^&]+)]], [[\2]])

local fcpn, err = io.open(“C:\\Temp\\” .. cpn, “r”) — “buka file dalam mode baca”
if fcpn then — ” file tidak ada”
fcpn:close() — “tutup variable”
local fcpn = io.open(“C:\\Temp\\” .. cpn, “w”) — “buka file dalam mode tulis”
fcpn:write(vid)
fcpn:close()
else –“file ada”
local fcpn = io.open(“C:\\Temp\\” .. cpn, “w”) — “buka file dalam mode tulis”
fcpn:write(vid)
fcpn:close()
end
end

if re.match(hc.url, [[.*youtube\.com/videoplayback.*]])
then
local cpn = re.find(hc.url, [[cpn=[^&]+]])
cpn = re.replace(cpn, [[(cpn)=([^&]+)]], [[\2]])

local fcpn = io.open(“C:\\Temp\\” .. cpn, “r”) — “buka file dalam mode baca”
if fcpn == nil then — ” file tidak ada”
else –“file ada”
local idx = fcpn:read(‘*a’)
local itag = re.find(hc.url, [[itag=[^&]+]])
itag = re.replace(itag, [[(itag=[^&]+)]], [[\1]])
local rng = re.find(hc.url, [[range=[^&]+]])
rng = re.replace(rng, [[(range=[^&]+)]], [[\1]])
if itag and idx then
— hc.put_msg(3, ‘id cocok\n’, itag2)
cache_file_itag = hc.cache_path ..’youtube.com\\videoplayback^\\’..itag..idx..’.flv’
hc.preform_cache_file_name(cache_file_itag)
hc.monitor_string = ‘url2file’
if itag and idx and rng then
cache_file_itagrng = hc.cache_path ..’youtube.com\\videoplayback^\\’..itag..idx..rng..’.flv’
hc.preform_cache_file_name(cache_file_itagrng)
hc.monitor_string = ‘url2file’
end
end
end
fcpn:close() — “tutup file yg telah dibuka”

— hc.put_msg(3, ‘id cocok\n’, itag2, idx, rng2)
— else
— hc.put_msg(3, ‘warning error’)
end
end

youtube oktober…

#####  crontab untuk menghapus file yg sudah tidak terpakai lebih dari 1 jam yang lalu

## crontab perbaikan dari warnet ersa pati ( pak lutfi ) 0 * * * * find /var/log/squid/ -maxdepth 1 ! -name “*.log” -type f -mmin +60 -delete >> /dev/null 2>&1############# Squid Config

acl youtube url_regex -i youtube.*(ptracking|stream_204|player_204|gen_204) .*$
acl youtube url_regex -i \.c\.(youtube|google)\.com\/(get_video|videoplayback|videoplay).*$
storeurl_access allow youtube

############ storeurl.pl ( squid-2.7.Stable9

} elsif ($X[1] =~ 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;
}
print $x . $X[1] . “\n”;

} elsif ($X[1] =~ m/^http\:\/\/.*(youtube|google).*videoplayback.*/){
@itag = m/[&?](itag=[0-9]*)/;
@ids = m/[&?]id\=([^\&\s]*)/;
@mime = m/[&?](mime\=[^\&\s]*)/;
@cpn = m/[&?]cpn\=([^\&\s]*)/;
if (defined($cpn[0])) {
$fn = “/var/log/squid/@cpn”;
if (-e $fn) {
open FH,”<“.$fn ;
$id  = <FH>;
chomp $id ;
close FH ;
} else {
$id = $ids[0] ;
}
} else {
$id = $ids[0] ;
}
@range = m/[&?](range=[^\&\s]*)/;
print $x . “http://video-srv.youtube.com.SQUIDINTERNAL/id=” . $id . “&@itag@range@mime\n”;

########## Store-ID.pl ( Squid-3.4 atau Squid-3.HEAD )

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 . “\n”;

} elsif ($x =~ m/^http\:\/\/.*(youtube|google).*videoplayback.*/){
@itag = m/[&?](itag=[0-9]*)/;
@ids = m/[&?]id\=([^\&\s]*)/;
@mime = m/[&?](mime\=[^\&\s]*)/;
@cpn = m/[&?]cpn\=([^\&\s]*)/;
if (defined($cpn[0])) {
$fn = “/var/log/squid/@cpn”;
if (-e $fn) {
open FH,”<“.$fn ;
$id  = <FH>;
chomp $id ;
close FH ;
} else {
$id = $ids[0] ;
}
} else {
$id = $ids[0] ;
}
@range = m/[&?](range=[^\&\s]*)/;
$out = “http://video-srv.youtube.com.SQUIDINTERNAL/id=” . $id . “&@itag@range@mime&#8221;;

Cache Youtube

Cache Youtube tanpa range

http://www.youtube.com/watch?v=KAL2hpJ1J2o&feature=relmfu

lumayan mengobati atas keinginan client yg videonya ingin full tanpa range,