资源简介
C#编写的spider demo 主要实现多线程的网页抓取及网页内容中URL的提取
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data;
using System.IO.Compression;
using System.Windows.Forms;
namespace spider_demo
{ // < * ? > : “ /\ | 不能建立成windows文件名或目录
class base64_my
{
public string base64Code(string Message)
{
StringBuilder tmp = new StringBuilder();
byte[] asciiBytes = Encoding.ASCII.GetBytes(“http://“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length-1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp .Append(“]“);
Message = Message.Replace(“http://“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiBytes = Encoding.ASCII.GetBytes(“\\“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length - 1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp.Append(“]“);
Message = Message.Replace(“\\“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiBytes = Encoding.ASCII.GetBytes(“/“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length - 1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp.Append(“]“);
Message = Message.Replace(“/“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiBytes = Encoding.ASCII.GetBytes(“?“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length - 1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp.Append(“]“);
Message = Message.Replace(“?“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiBytes = Encoding.ASCII.GetBytes(“*“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length - 1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp.Append(“]“);
Message = Message.Replace(“*“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiBytes = Encoding.ASCII.GetBytes(“+“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length - 1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp.Append(“]“);
Message = Message.Replace(“+“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiBytes = Encoding.ASCII.GetBytes(“|“);
tmp.Append(“[“);
for (int i = 0; i <= asciiBytes.Length - 1; i++)
{
tmp.Append(asciiBytes[i].ToString());
}
tmp.Append(“]“);
Message = Message.Replace(“|“ tmp.ToString());
tmp.Remove(0 tmp.Length);
asciiByte
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2006-08-13 01:07 spider_demo
....... 922 2006-08-10 22:54 spider_demo\spider_demo.sln
..A..H. 31744 2006-11-02 14:13 spider_demo\spider_demo.suo
目录 0 2006-08-13 01:07 spider_demo\spider_demo
....... 11108 2006-08-12 23:39 spider_demo\spider_demo\ba
文件 4040 2006-09-03 00:18 spider_demo\spider_demo\workThread.cs
....... 1850 2006-08-14 15:59 spider_demo\spider_demo\spider_demo.cs
文件 7841 2006-09-03 00:39 spider_demo\spider_demo\spider.cs
文件 3600 2006-09-01 16:51 spider_demo\spider_demo\spider_demo.csproj
....... 2679 2006-08-14 15:08 spider_demo\spider_demo\spider_demo.Designer.cs
....... 459 2006-08-14 15:53 spider_demo\spider_demo\Listener.cs
....... 5814 2006-08-14 15:08 spider_demo\spider_demo\spider_demo.resx
目录 0 2006-08-13 01:07 spider_demo\spider_demo\bin
目录 0 2006-08-13 01:07 spider_demo\spider_demo\bin\Release
....... 12288 2006-08-12 14:08 spider_demo\spider_demo\bin\Release\WebRegex.dll
目录 0 2006-08-14 16:05 spider_demo\spider_demo\bin\Release\html
文件 101 2006-08-14 15:04 spider_demo\spider_demo\bin\Release\yy.txt
目录 0 2006-08-13 01:07 spider_demo\spider_demo\bin\Debug
....... 12288 2006-08-12 14:08 spider_demo\spider_demo\bin\Debug\WebRegex.dll
文件 101 2006-08-14 15:04 spider_demo\spider_demo\bin\Debug\yy.txt
目录 0 2006-09-11 12:18 spider_demo\spider_demo\bin\Debug\html
目录 0 2006-08-13 01:07 spider_demo\spider_demo\obj
文件 620 2006-11-02 14:11 spider_demo\spider_demo\obj\spider_demo.csproj.FileList.txt
目录 0 2006-08-13 01:07 spider_demo\spider_demo\obj\Release
目录 0 2006-08-13 01:07 spider_demo\spider_demo\obj\Release\TempPE
文件 4608 2006-08-12 18:44 spider_demo\spider_demo\obj\Release\TempPE\Properties.Resources.Designer.cs.dll
目录 0 2006-08-14 15:08 spider_demo\spider_demo\obj\Release\Refactor
目录 0 2006-08-13 01:07 spider_demo\spider_demo\obj\Debug
目录 0 2006-08-13 01:07 spider_demo\spider_demo\Properties
....... 1170 2006-08-10 18:19 spider_demo\spider_demo\Properties\AssemblyInfo.cs
............此处省略13个文件信息
- 上一篇:生产者消费者为模型的多线程编程c#原创
- 下一篇:C#写的地理信息系统初级代码
评论
共有 条评论