读书人

上个美女玩玩

发布时间: 2012-11-03 10:57:44 作者: rapoo

下个美女玩玩

上个美女玩玩


using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.IO;

namespace DownLoad
{
class Program
{
static void Main(string[] args)
{
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string url = "http://www.qqjay.com/html/old8/fzl/index.html";
string html= wc.DownloadString(url);
string regImage = "<img src=\"(.+)\"\\s+title =\"(.+)\"\\s+width=\"(.+)\"\\s+height=\"(.+)\" />";
MatchCollection matchs = Regex.Matches(html, regImage);
WebClient wcdown = new WebClient();
foreach (Match item in matchs)
{
if (item.Success)
{ //获取图片相对路径
string path = item.Groups[1].Value;
Console.WriteLine(path);
string imgpath = "http://www.qqjay.com" + path;
wcdown.DownloadFile(imgpath,@"D:\课程资源\图片\"+Path.GetFileName(imgpath));
}

}
Console.WriteLine("文件下载成功!!");
Console.ReadKey();

}
}
}

上个美女玩玩



读书人网 >编程

热点推荐