Hi Guys,
i have found this article on dynamically updating an address list for all youtube IP's. However the script does not create the address list.
http://adminsline.wordpress.com/2012/08/03/mikrotik-youtube/
I'm not experienced at all with how scripting works, and I'm guessing my problem is that by just doing a copy/paste of the script in this example adds line breaks and such where they shouldn't be...
Can anyone check this script and let me know where to remove the breaks and such? Thanks
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
:local cacheName [/ip dns cache all get $i name] ;
:put $cacheName;
:if ([:find $cacheName "youtube"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
:put $tmpAddress;
if address list is empty do not check
:if ( [/ip firewall address-list find ] = "") do={
:log info ("added entry: $[/ip dns cache get $i name] IP $tmpAddress");
/ip firewall address-list add address=$tmpAddress list=youtube_dns_ips comment=$cacheName;
} else={
:foreach j in=[/ip firewall address-list find ] do={
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
:if ( $bNew = "true" ) do={
:log info ("added entry: $[/ip dns cache get $i name] IP $tmpAddress");
/ip firewall address-list add address=$tmpAddress list=youtube_dns_ips comment=$cacheName;
}
}
}
}