抓取网页中图片的方法

代码示例:

 WebClient wc = new WebClient();
            byte[] bytes = new byte[1255];
            bytes = wc.DownloadData("http://www.cnblogs.com/");//要抓取的网址
            string srt = Encoding.UTF8.GetString(bytes);//将byte类型的数据转换成string类型
            //</?(a|A)( .*?>|>(.*)
            string getImg = "<img(.*)src=\"(.*).gif\"(.*)/>";//要匹配的正则表达式
            Match match = Regex.Match(srt, getImg);
          
            Response.Write(match.Groups[2].Value.ToString()+".gif");
原文地址:https://www.cnblogs.com/xuhongfei/p/3072837.html