%This code downloaded cartoons from http://www.kayhannews.ir/
%Arash Kamangir, kamangirblog@yahoo.ca
%6 September 2007

close all
clc
clear

for year=85:86
    for month=1:12
       
        %Not all months for 1386 are available
        if year==86
            if month>6
                return
            end
        end

        %Checking all days.
        disp(sprintf('13%g\\%g:',year,month));

        for day=1:31
            ys=sprintf('%g',year);
            if month<10
                ms=sprintf('0%g',month);
            else
                ms=sprintf('%g',month);
            end
            if day<10
                ds=sprintf('0%g',day);
            else
                ds=sprintf('%g',day);
            end
            ss=sprintf('%s%s%s',ys,ms,ds);

            url=sprintf('http://www.kayhannews.ir/%s/image2.gif',ss);

            filename=sprintf('%s.gif',ss);

            [f,status]=urlwrite(url,filename);
            if status==0
                disp(sprintf('\b!'));
            else
                disp(sprintf('\b.'));
            end
        end
    end
end
