getdata

public partial class GetData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

//string path = Server.MapPath("~/css/css.css");
//using (StreamReader sr = new StreamReader(path))
//{
// string all_code = sr.ReadToEnd();
// ArrayList my_list = new ArrayList();
// //string p = @"http://([w-]+.)+[w-]+(/[w- ./?%&=]*)?";
// string p = @"background:url((?<ImgUrl>.*?))";
// //string p = @"(?<=(?:srcs*=s*['""]?|background:s*.*?url()(?!http:))/?([^'""s)]+)";
// Regex re = new Regex(p, RegexOptions.IgnoreCase);
// MatchCollection mc = re.Matches(all_code);

// for (int i = 0; i <= mc.Count - 1; i++)
// {
// bool _foo = false;
// string name = "http://d1mr.com/" + mc[i].ToString().TrimEnd(')').Replace("background:url(", "");
// //string name = mc[i].ToString();
// foreach (string list in my_list)
// {
// if (name == list)
// {
// _foo = true;
// break;
// }
// }//过滤
// if (!_foo)
// {
// try
// {
// WebClient wc = new WebClient();
// wc.DownloadFile(name, Server.MapPath("~/images") + @"" + Path.GetFileName(name));
// }
// catch (Exception ex)
// {

// }


// //images
// //Response.Write(name + " ");
// }

// }
//}

//string path = Server.MapPath("~/images1");
//foreach (string item in Directory.GetFiles(path))
//{
// //string pageHtml = LeYour.Common.WebCatcher.GetPageData("http://localhost:3333/经典香氛_美容健康_YOKA时尚网.htm");
// string pageHtml = LeYour.Common.WebCatcher.GetPageData("http://localhost:3333/shoumm/" + Path.GetFileName(item));
// Regex searchTitle = new Regex("<title>(?<title>[\s\S]*?)<\/title>", RegexOptions.IgnoreCase);
// Match oM = searchTitle.Match(pageHtml);

// if (oM.Success)
// {
// Response.Write(oM.Groups["title"].Value.Trim());
// string matchEvents = "<table width="600" border="0" cellpadding="3".*?</table>";
// string Content = Regex.Match(pageHtml, matchEvents, RegexOptions.Singleline).Value;

// if (!string.IsNullOrEmpty(Content))
// {
// ICommon common = CommonProxy.GetProxy("MeiRong.MeiRong_Temp", "ID");
// Dictionary<string, object> dict = new Dictionary<string, object>();
// dict.Add("Title", oM.Groups["title"].Value.Trim());
// dict.Add("Content", Content);
// dict.Add("CreateTime", DateTime.Now);
// common.Insert(dict);
// //Response.Write(Events);
// }

// }

//}

//string matchEvents = "(<table width="600" border="0" cellpadding="3".*?</table>)(?:\s*<div align="center">)";


// string path = Server.MapPath("~/hufu[1].txt");
// using (StreamReader sr = new StreamReader(path))
// {
// string all_code = sr.ReadToEnd();
// ArrayList my_list = new ArrayList();
// string p = @"http://([w-]+.)+[w-]+(/[w- ./?%&=]*)?";
// Regex re = new Regex(p, RegexOptions.IgnoreCase);
// MatchCollection mc = re.Matches(all_code);

// for (int i = 0; i <= mc.Count - 1; i++)
// {
// bool _foo = false;
// string name = mc[i].ToString();
// foreach (string list in my_list)
// {
// if (name == list)
// {
// _foo = true;
// break;
// }
// }//过滤
// if (!_foo)
// {
// try
// {
// WebClient wc = new WebClient();
// wc.DownloadFile(name, Server.MapPath("~/images") + @"" + Path.GetFileName(name));
// }
// catch
// {

// }


// //images
// //Response.Write(name + " ");
// }

// }
// }
}

原文地址:https://www.cnblogs.com/zwei1121/p/3409281.html