抓取源码爱好者所有网页特效例子并保存到本地
2010-06-27 21:12
393 查看
提取http://www.codefans.net/jscss/code/1866.shtm等l类似网页中运行区块的html代码 并保存到本地.
应该是将 源码爱好者 » 网页特效代码 下面的子目录都抓下来了, 我机器上运行了15min抓了有10几个子目录 共4M多
用到了正则表达式,文件读取保存, 多线程
是用vs2005写的, winform
form1.cs
代码
namespace dig
{
partial class form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnStart = new System.Windows.Forms.Button();
this.txtUrl = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtSaveUrl = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label3 = new System.Windows.Forms.Label();
this.lblTime = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lblTimeElapsed = new System.Windows.Forms.Label();
this.btnStop = new System.Windows.Forms.Button();
this.btnPause = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(97, 263);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.TabIndex = 0;
this.btnStart.Text = "&Start";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// txtUrl
//
this.txtUrl.Location = new System.Drawing.Point(95, 20);
this.txtUrl.Name = "txtUrl";
this.txtUrl.ReadOnly = true;
this.txtUrl.Size = new System.Drawing.Size(326, 21);
this.txtUrl.TabIndex = 1;
this.txtUrl.Text = "http://www.codefans.net/jscss/code/1866.shtml";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(30, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 12);
this.label1.TabIndex = 2;
this.label1.Text = "远程文件:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(30, 82);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 12);
this.label2.TabIndex = 3;
this.label2.Text = "保存位置:";
//
// txtSaveUrl
//
this.txtSaveUrl.Location = new System.Drawing.Point(97, 79);
this.txtSaveUrl.Name = "txtSaveUrl";
this.txtSaveUrl.ReadOnly = true;
this.txtSaveUrl.Size = new System.Drawing.Size(326, 21);
this.txtSaveUrl.TabIndex = 1;
this.txtSaveUrl.Text = "http://www.codefans.net/jscss/code/1866.shtml";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(30, 141);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.TabIndex = 4;
this.label3.Text = "当前时间:";
//
// lblTime
//
this.lblTime.AutoSize = true;
this.lblTime.Location = new System.Drawing.Point(95, 141);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(35, 12);
this.lblTime.TabIndex = 5;
this.lblTime.Text = "12:00";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(30, 200);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.TabIndex = 4;
this.label4.Text = "共用时间:";
//
// lblTimeElapsed
//
this.lblTimeElapsed.AutoSize = true;
this.lblTimeElapsed.Location = new System.Drawing.Point(95, 201);
this.lblTimeElapsed.Name = "lblTimeElapsed";
this.lblTimeElapsed.Size = new System.Drawing.Size(11, 12);
this.lblTimeElapsed.TabIndex = 5;
this.lblTimeElapsed.Text = "0";
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(290, 263);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 0;
this.btnStop.Text = "S&top";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnPause
//
this.btnPause.Location = new System.Drawing.Point(194, 263);
this.btnPause.Name = "btnPause";
this.btnPause.Size = new System.Drawing.Size(75, 23);
this.btnPause.TabIndex = 0;
this.btnPause.Text = "&Pause";
this.btnPause.UseVisualStyleBackColor = true;
this.btnPause.Click += new System.EventHandler(this.btnPause_Click);
//
// form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(442, 313);
this.Controls.Add(this.lblTimeElapsed);
this.Controls.Add(this.lblTime);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtSaveUrl);
this.Controls.Add(this.txtUrl);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnPause);
this.Controls.Add(this.btnStart);
this.Name = "form1";
this.Text = "提取网页";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.form1_FormClosed);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.TextBox txtUrl;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtSaveUrl;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblTimeElapsed;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnPause;
}
}
源码下载
应该是将 源码爱好者 » 网页特效代码 下面的子目录都抓下来了, 我机器上运行了15min抓了有10几个子目录 共4M多
用到了正则表达式,文件读取保存, 多线程
是用vs2005写的, winform
form1.cs
代码
namespace dig
{
partial class form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnStart = new System.Windows.Forms.Button();
this.txtUrl = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtSaveUrl = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label3 = new System.Windows.Forms.Label();
this.lblTime = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lblTimeElapsed = new System.Windows.Forms.Label();
this.btnStop = new System.Windows.Forms.Button();
this.btnPause = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(97, 263);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.TabIndex = 0;
this.btnStart.Text = "&Start";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// txtUrl
//
this.txtUrl.Location = new System.Drawing.Point(95, 20);
this.txtUrl.Name = "txtUrl";
this.txtUrl.ReadOnly = true;
this.txtUrl.Size = new System.Drawing.Size(326, 21);
this.txtUrl.TabIndex = 1;
this.txtUrl.Text = "http://www.codefans.net/jscss/code/1866.shtml";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(30, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 12);
this.label1.TabIndex = 2;
this.label1.Text = "远程文件:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(30, 82);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 12);
this.label2.TabIndex = 3;
this.label2.Text = "保存位置:";
//
// txtSaveUrl
//
this.txtSaveUrl.Location = new System.Drawing.Point(97, 79);
this.txtSaveUrl.Name = "txtSaveUrl";
this.txtSaveUrl.ReadOnly = true;
this.txtSaveUrl.Size = new System.Drawing.Size(326, 21);
this.txtSaveUrl.TabIndex = 1;
this.txtSaveUrl.Text = "http://www.codefans.net/jscss/code/1866.shtml";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(30, 141);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.TabIndex = 4;
this.label3.Text = "当前时间:";
//
// lblTime
//
this.lblTime.AutoSize = true;
this.lblTime.Location = new System.Drawing.Point(95, 141);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(35, 12);
this.lblTime.TabIndex = 5;
this.lblTime.Text = "12:00";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(30, 200);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.TabIndex = 4;
this.label4.Text = "共用时间:";
//
// lblTimeElapsed
//
this.lblTimeElapsed.AutoSize = true;
this.lblTimeElapsed.Location = new System.Drawing.Point(95, 201);
this.lblTimeElapsed.Name = "lblTimeElapsed";
this.lblTimeElapsed.Size = new System.Drawing.Size(11, 12);
this.lblTimeElapsed.TabIndex = 5;
this.lblTimeElapsed.Text = "0";
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(290, 263);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 0;
this.btnStop.Text = "S&top";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnPause
//
this.btnPause.Location = new System.Drawing.Point(194, 263);
this.btnPause.Name = "btnPause";
this.btnPause.Size = new System.Drawing.Size(75, 23);
this.btnPause.TabIndex = 0;
this.btnPause.Text = "&Pause";
this.btnPause.UseVisualStyleBackColor = true;
this.btnPause.Click += new System.EventHandler(this.btnPause_Click);
//
// form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(442, 313);
this.Controls.Add(this.lblTimeElapsed);
this.Controls.Add(this.lblTime);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtSaveUrl);
this.Controls.Add(this.txtUrl);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnPause);
this.Controls.Add(this.btnStart);
this.Name = "form1";
this.Text = "提取网页";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.form1_FormClosed);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.TextBox txtUrl;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtSaveUrl;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblTimeElapsed;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnPause;
}
}
源码下载
相关文章推荐
- nodejs抓取网页的源码,并保存到本地文件
- 分享PHP源码批量抓取远程网页图片并保存到本地的实现方法
- 分享PHP源码批量抓取远程网页图片并保存到本地的实现方法
- python抓取网页中图片并保存到本地
- python抓取网页中图片并保存到本地
- [分享黑科技]纯js突破localstorage存储上线,远程抓取图片,并转码base64保存本地,最终实现整个网站所有静态资源离线到用户手机效果却不依赖浏览器的缓存机制,单页应用最新黑科技
- Python3使用requests包抓取并保存网页源码的方法
- beautifulsoup库简单抓取网页--获取所有链接例子
- 黄聪:python访问抓取网页常用命令(保存图片到本地、模拟POST、GET、中文编码问题)
- python3使用requests包抓取并保存网页源码
- Python3.4 获取百度网页源码并保存在本地文件中
- C# 抓取网页上的图片,保存本地
- 学习WebClient类 及Match.Groups 属性 保存网页所有超链接到本地
- Python3使用requests包抓取并保存网页源码的方法
- 用thinkphp写的一个例子:抓取网站的内容并且保存到本地
- 保存网页文件目录中所有文件到本地
- Java Jsoup抓取符合指定大小的网页的图片,并保存在本地磁盘
- python抓取网页中图片并保存到本地
- python抓取网页中图片并保存到本地
- 黄聪:python访问抓取网页常用命令(保存图片到本地、模拟POST、GET、中文编码问题)