去年的时候有位发了份原码,我放邮箱里,后来有事.今年打开邮箱正好那份源码没法下载下来了!
哪个有源码或讲讲原理啊!
哪个有源码或讲讲原理啊!
解决方案 »
- 如何点击一个文本框,不让光标停在上面,能获得click事件?
- 最近浏览的商品与网站的高级搜索
- 关于TREEVIEW NavigateUrl 控件符值
- detailsview控件问题.
- 在2003中运行。NET出现乱码!
- 关于登录进入页面后的问题
- 南京要成立程序员协会[官方]了,大家来发表一下看法吧!
- saucer(思归),请进,刚才的问题解决了,谢谢!再多问一个问题;<iframe>是可编辑状态,要改变选取字符串的字体,如何实现,谢谢!比较急
- .Net数据库连接问题
- Session_Start不准确?
- 怎么清空aspx页面的代码,重新输出为自己的html代码?
- 请问哪本讲ActiveX的书好哦?最好是通过实例讲解的
请求获取HTML代码
分析HTML代码获取所有小说的URL地址
在请求
正则处理
保存数据库
贴点代码给你参考一下
System.Net.WebClient cli = new System.Net.WebClient();
Uri u = new Uri(Settings1.Default.Uri);
int i = Settings1.Default.Uri.LastIndexOf('/');
string sSite = Settings1.Default.Uri.Substring(0, i + 1);
string sPage = Settings1.Default.Uri.Substring(i + 1);
byte[] buff=cli.DownloadData(u);
Encoding enc = Encoding.GetEncoding(Settings1.Default.Encode);
Regex r = new Regex(Settings1.Default.NextReg, RegexOptions.IgnoreCase);
Regex r2 = new Regex(Settings1.Default.TextBeg, RegexOptions.IgnoreCase);
string sContent = enc.GetString(buff);
while (true) {
string sText = "";
i = sContent.IndexOf(Settings1.Default.TextBeg);
if (i > 0) {
int j = sContent.IndexOf(Settings1.Default.TextEnd, i + 1);
if (j > 0) {
sText = sContent.Substring(i + Settings1.Default.TextBeg.Length, j - i - Settings1.Default.TextBeg.Length - 1);
// sText = sText.Replace("<br />", "\r\n");
// sText = sText.Replace(" ", " ");
}
}
string sNextPage="";
Match m = r.Match(sContent);
if (m.Success)
{
sNextPage = m.Result("$1");
WritePage(sPage, sNextPage, sText);
}
else {
WritePage(sPage, sNextPage, sText);
break;
}
sPage = sNextPage;
u = new Uri(sSite + sPage);
buff = cli.DownloadData(u);
sContent = enc.GetString(buff);
m = r.Match(sContent);
}
sPage = sPage.Replace(".asp", ".html");
sNextPage = sNextPage.Replace(".asp", ".html");
FileStream fs = new FileStream(Settings1.Default.LocalPath + sPage, FileMode.Create);
StreamWriter s = new StreamWriter(fs);
s.Write("<html><head><title>javascript using Array</title></head><body>");
//s.Write("<pre>");
s.Write(sText);
//s.Write("</pre>");
s.Write("<a id='anext' href='" + sNextPage + "' target='_self'>nextpage</a>");
s.Write("</body></html>");
s.Close();
fs.Close();
}