最新yahoo相册批量下载工具v1.2(一口气下载整个相册)

来源:互联网 发布:sql server书籍 编辑:程序博客网 时间:2024/05/01 23:18

我把上次的 作了一些更改, 现在的版本,只需要填入yahoo相册的地址,软件就会自动现在整个相册,并且按相册的目录自动生成 保存图片的目录。一切自动,方便好用。当然还有不完善的地方,中途不能停止,不能显示图片下载进度,不能断点续传。这几天比较忙,以后再作完善。谢谢大家的支持!

一下是部分代码:

因为暂时不能上传软件,需要的和我联系吧!!!!

 Regex UrlRegex = new Regex(@"&aid=([/w]*)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
   Regex UrlRegex1 = new Regex(@"<h4 >([/w-]*)</h4>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
   Regex UrlRegex2 = new Regex(@"&pid=([/w]*).jpg", RegexOptions.IgnoreCase | RegexOptions.Compiled);
   Regex UrlRegex3= new Regex(@"http://([/w-]+/.)+[/w-]+(/[/w-   ./?%&=]*).jpg", RegexOptions.IgnoreCase | RegexOptions.Compiled);
  // Regex UrlRegex = new Regex(@"http://cn.f11.([/w-]+/.)+[/w-]+(/[/w-   ./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
   MatchCollection matches1 = UrlRegex1.Matches(content);
   foreach (Match match1 in matches1)
   {
   
    album[albumn]=match1.Value.ToString().Substring(5,match1.Value.ToString().Length-10);   
    albumn++;
    

   }

   int albumindex=0;
   MatchCollection matches = UrlRegex.Matches(content);
   foreach (Match match in matches)
   {
    //contentstr=contentstr+urladdr+match.Value.ToString()+"/n";
    string albumaddr=urladdr+match.Value.ToString();
    albumcontent=sethttpurl(albumaddr);
    MatchCollection matches2 = UrlRegex2.Matches(albumcontent);
    foreach (Match match2 in matches2)
    {
     int namepos=match2.Value.ToString().IndexOf("=");
     string picname=match2.Value.ToString().Substring(namepos+1,match2.Value.ToString().Length-namepos-1);
     string downaddr="http://photos.i.cn.yahoo.com/down-"+urladdrnode+match.Value.ToString()+match2.Value.ToString();
     downcontent=sethttpurl(downaddr);
     MatchCollection matches3 = UrlRegex3.Matches(downcontent);
     if(!System.IO.Directory.Exists(textBox4.Text+"//"+album[albumindex].ToString()))
      System.IO.Directory.CreateDirectory(textBox4.Text+"//"+album[albumindex].ToString());

     foreach (Match match3 in matches3)
     {
      contentstr=contentstr+match3.Value.ToString()+"/n";
      
      try
      {
       //wc.DownloadFile(match3.Value.ToString(),textBox4.Text+"//"+i.ToString()+picname);
      
       wc.DownloadFile(match3.Value.ToString(),textBox4.Text+"//"+album[albumindex].ToString()+"//"+i.ToString()+picname);
       
       i=i+1;
      
      }
      catch(System.Net.WebException ex)
      { 
       contentstr=contentstr+ex.ToString()+"可能有错请检查下载的图片是否正确!"+"/n";
      }

     }

     
    }
    albumindex++;

原创粉丝点击