Francoo

Images Downloader Script

Jan 4th, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.65 KB | None | 0 0
  1. % Although it could be done better in bash, I needed a quick script do download a series of images from a book.
  2.  
  3. startUrl='http://img.phombo.com/img1/photocombo/72/Ep';
  4. midUrl='-';
  5. endUrl='.jpg';
  6.  
  7. for k=1:6
  8.     fCount=0;
  9.     for i = 0:100
  10.         fName='--';
  11.  
  12.         mcnt=num2str(k,'%01u');
  13.         scnt=num2str(i,'%03u');
  14.  
  15.         try
  16.             fName=urlwrite([startUrl mcnt midUrl scnt endUrl],['img_' mcnt '_' scnt '.jpg']);
  17.         end
  18.  
  19.         disp(fName)
  20.         disp([mcnt '-' scnt])
  21.  
  22.         if strcmp(fName,'--')
  23.             fCount=fCount+1;
  24.             if fCount>15
  25.                 break
  26.             end
  27.         end
  28.     end
  29. end
Add Comment
Please, Sign In to add comment