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 = @"(?<=\b(?:src\s*=\s*['""]?|background:\s*.*?\burl\b\()(?!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 + "\n");
// }

// }
//}

//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 + "\n");
// }

// }
// }
}

转载于:https://www.cnblogs.com/zwei1121/p/3409281.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值