免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: zhoulifa
打印 上一主题 下一主题

[原创] 用 C 语言编写一个网络蜘蛛来搜索网上出现的电子邮件地址 [复制链接]

论坛徽章:
0
41 [报告]
发表于 2006-09-08 18:16 |只看该作者
原帖由 goldeagle 于 2006-9-7 22:43 发表
辛苦了,不过,恩…… why not nutch?


不交流不知道,上面 cmzhubill 介绍了larbin,这里又来了个nutch,其它这方面成熟的软件还真不少,可惜以前不知道。
想请教一下cmzhubill 和 goldeagle ,你们是怎么知道这样的好软件的呢?
怎样才能方便快捷地发现好软件呢?

论坛徽章:
0
42 [报告]
发表于 2006-09-08 22:41 |只看该作者
给楼主一个建议

楼主可以把mail分析加入larbin的协议处理里,然后看能否提到larbin project中

另:我的建议是楼主最好是去作wap处理,而不是mail处理,在larbin中加入wap的协议处理也许更有价值,也许还有商业价值

论坛徽章:
0
43 [报告]
发表于 2006-09-08 23:43 |只看该作者
建议楼主在检查是否已经爬取过的网站的时候可以采用hash的方法,larbin是这样做的,我觉得那样更简单高效.

论坛徽章:
0
44 [报告]
发表于 2006-09-09 01:35 |只看该作者
感谢楼主分享!!

论坛徽章:
0
45 [报告]
发表于 2006-09-09 11:27 |只看该作者

支持

写的很好,正在仔细研究

论坛徽章:
0
46 [报告]
发表于 2006-09-09 12:47 |只看该作者
强烈支持!!

论坛徽章:
0
47 [报告]
发表于 2006-09-10 08:40 |只看该作者
[root@aleph1602-linux root]# gcc mailaddrsearch.c -o mailsearcher -Wall -g
mailaddrsearch.c: In function `main':
mailaddrsearch.c:301: warning: passing arg 1 of `GetHost' from incompatible pointer type
mailaddrsearch.c:302: warning: char format, pointer arg (arg 3)
[root@aleph1602-linux root]# ./mailsearcher http://www.xxx.xxx.cn/index.php
GetHost error from '????

注:
操作系统RedHat AS3
[root@aleph1602-linux root]# uname -a
Linux aleph1602-linux 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:31:21 EDT 2003 i686 athlon i386 GNU/Linux
[root@aleph1602-linux root]# gcc --version
gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

论坛徽章:
0
48 [报告]
发表于 2006-09-10 12:28 |只看该作者
不懂,明知道有[i]标记还不放到[code][/code]里去。

论坛徽章:
0
49 [报告]
发表于 2006-09-10 13:56 |只看该作者
GNM , zhumao :
我这里实在找不到一个类似你们所说的版本,太久不用Red Hat的东西了,而下载速度又不快。我刚才在一个Red Hat版本里做过实验,这是我的Red Hat版本:
[root@sunny ~]# uname -a
Linux sunny 2.6.9-5.EL #1 Wed Jan 5 19:22:18 EST 2005 i686 i686 i386 GNU/Linux
[root@sunny ~]# gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)


我实验结果也是没问题的,输出内容是:

  1. [root@sunny ~]# gcc -Wall -g mailsearch.c
  2. [root@sunny ~]# ./a.out "http://bn.sina.com.cn/pv/index.html"

  3. Display.    1:
  4.         bn.sina.com.cn:80/pv/index.html => file00000.html 0
  5.         Request.1 is:
  6. GET /pv/index.html HTTP/1.0
  7. Host: bn.sina.com.cn
  8. User-Agent: Wget/1.10.2
  9. Accept: */*
  10. Connection: keep-alive


  11.         Request.1 115 bytes send OK!

  12.         The following is the response header:
  13. HTTP/1.1 200 OK
  14. Date: Sun, 10 Sep 2006 05:39:53 GMT
  15. Server: Apache/1.3.27 (Unix)
  16. Last-Modified: Sun, 10 Sep 2006 05:32:00 GMT
  17. ETag: "1d7652-13296-4503a350"
  18. Accept-Ranges: bytes
  19. Content-Length: 78486
  20. Keep-Alive: timeout=15, max=10000
  21. Connection: Keep-Alive
  22. Content-Type: text/html


  23. Display.   56:
  24.         bn.sina.com.cn:80/pv/index.html => file00000.html 1

  25.         bn.sina.com.cn:80/bbs/p/2006/0906/16121295.html => file00001.html 0
  26.         bn.sina.com.cn:80/bbs/p/2006/0906/14121292.html => file00002.html 0
  27.         bn.sina.com.cn:80/bbs/p/2006/0905/15431284.html => file00003.html 0
  28.         bn.sina.com.cn:80/bbs/p/2006/0901/14251263.html => file00004.html 0
  29.         bn.sina.com.cn:80/bbs/p/2006/0901/14131261.html => file00005.html 0
  30.         bn.sina.com.cn:80/bbs/p/2006/0901/14151262.html => file00006.html 0
  31.         bn.sina.com.cn:80/bbs/p/2006/0830/15271245.html => file00007.html 0
  32.         bn.sina.com.cn:80/bbs/p/2006/0904/15471273.html => file00008.html 0
  33.         bn.sina.com.cn:80/bbs/p/2006/0904/16091275.html => file00009.html 0
  34.         bn.sina.com.cn:80/bbs/p/2006/0905/15151283.html => file00010.html 0
  35.         bn.sina.com.cn:80/dv/mmx.html => file00011.html 0
  36.         bn.sina.com.cn:80/dv/flashgame.html => file00012.html 0
  37.         bn.sina.com.cn:80/dv/flashgame.htm => file00013.html 0
  38.         bn.sina.com.cn:80/pv/# => file00014.html 0
  39.         bn.sina.com.cn:80/dv/eryueyatou.html => file00015.html 0
  40.         bn.sina.com.cn:80/bbs/2006/0427/1452523.html => file00016.html 0
  41.         bn.sina.com.cn:80/bbs/2006/0330/1831383.html => file00017.html 0
  42.         bn.sina.com.cn:80/pv/moshu.html => file00018.html 0
  43.         bn.sina.com.cn:80/dv/streetmagicians.html => file00019.html 0
  44.         bn.sina.com.cn:80/blog/index.html => file00020.html 0
  45.         bn.sina.com.cn:80/dv/huwai/index.shtml => file00021.html 0
  46.         bn.sina.com.cn:80/bbs/p/2006/0719/1651999.html => file00022.html 0
  47.         bn.sina.com.cn:80/bbs/p/2006/0717/1534979.html => file00023.html 0
  48.         bn.sina.com.cn:80/bbs/p/2006/0712/1839950.html => file00024.html 0
  49.         bn.sina.com.cn:80/bbs/p/2006/0605/1124684.html => file00025.html 0
  50.         bn.sina.com.cn:80/bbs/p/2006/0524/1623620.html => file00026.html 0
  51.         bn.sina.com.cn:80/bbs/p/2006/0607/1835714.html => file00027.html 0
  52.         bn.sina.com.cn:80/bbs/p/2006/0511/1435560.html => file00028.html 0
  53.         bn.sina.com.cn:80/bbs/p/2006/0517/1633575.html => file00029.html 0
  54.         bn.sina.com.cn:80/bbs/2006/0406/1110426.html => file00030.html 0
  55.         bn.sina.com.cn:80/dv/funny/index.shtml => file00031.html 0
  56.         bn.sina.com.cn:80/dv/love2006.html => file00032.html 0
  57.         auto.sina.com.cn:80/z/shipin/index.shtml => file00033.html 0
  58.         www.22film.com:80/ => file00034.html 0
  59.         www.streetballa.com:80/ => file00035.html 0
  60.         www.dvchina.cn:80/ => file00036.html 0
  61.         new.dvchina.cn:80/ => file00037.html 0
  62.         www.20802.com:80/ => file00038.html 0
  63.         www.cetv.edu.cn:80/program/a0908/index.php => file00039.html 0
  64.         www.pop-photo.com.cn:80/index.html => file00040.html 0
  65.         www.chndv.cn:80/ => file00041.html 0
  66.         www.pconline.com.cn:80/digital/dv/ => file00042.html 0
  67.         www.nbdv.net:80/ => file00043.html 0
  68.         www.3cworld.com.cn:80/ => file00044.html 0
  69.         www.bjlongs.com:80/ => file00045.html 0
  70.         www.tailenet.com:80/ => file00046.html 0
  71.         corp.sina.com.cn:80/chn/ => file00047.html 0
  72.         corp.sina.com.cn:80/eng/ => file00048.html 0
  73.         ads.sina.com.cn:80/ => file00049.html 0
  74.         corp.sina.com.cn:80/chn/sina_job.html => file00050.html 0
  75.         www.sina.com.cn:80/intro/lawfirm.shtml => file00051.html 0
  76.         englishcenter.sina.com:80/ => file00052.html 0
  77.         unipro.sina.com.cn:80/cgi-bin/regist0.cgi?url1=&url2=&id1=1&id2=0&entry=people&mcheck=bb25a9cc2d921f9d191ea3c76c7278b7 => file00053.html 0
  78.         tech.sina.com.cn:80/focus/sinahelp.shtml => file00054.html 0
  79.         home.sina.com.cn:80/intro/copyright.shtml => file00055.html 0
  80.         Request.2 is:
  81. GET /bbs/p/2006/0906/16121295.html HTTP/1.0
  82. Host: bn.sina.com.cn
  83. User-Agent: Wget/1.10.2
  84. Accept: */*
  85. Connection: keep-alive


  86.         Request.2 131 bytes send OK!
复制代码


我仔细比较了你们的系统和我的系统,除了gcc版本不同外,另外一个最重要的差别是内核版本我这里是2.6,而你们都是2.4的,不知道是不是这个问题。

建议你们用Debian、Ubuntu之类的试试,所有的软件包管理一个apt命令搞定,不需要自己去到处找包,不需要自己解决包之前的依赖关系。找软件用命令:

  1. apt-cache search x
复制代码

注:这里x是软件包名称或这个软件包的描述字符中的一个
安装软件用命令:

  1. apt-get install x
复制代码


比如我这里:
test@local:~$ apt-cache search crawler
htdig - WWW search system for an intranet or small internet
htdig-doc - Documentation for the htdig package
test@local:~$ sudo apt-get install htdig
Password:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
将会安装下列额外的软件包:
  gawk libdb2 lockfile-progs
建议安装的软件包:
  catdoc pstotext gs xpdf xpdf-i
推荐安装的软件包:
  wwwoffle htdig-doc
下列【新】软件包将被安装:
  gawk htdig libdb2 lockfile-progs
共升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 2 个软件未被升级。
需要下载 2112kB 的软件包。
解压缩后会消耗掉 6119kB 的额外空间。
您希望继续执行吗?[Y/n]

你只需要确认一下,需要安装的4个软件包就会自动安装完成,不用你自己去找。开发人员可以专心地去做程序而省去了搜索软件包的麻烦。

Red Hat说实在地太商业化了,不是开发人员用的版本。

论坛徽章:
0
50 [报告]
发表于 2006-09-10 14:02 |只看该作者
原帖由 benlan 于 2006-9-8 22:41 发表
给楼主一个建议

楼主可以把mail分析加入larbin的协议处理里,然后看能否提到larbin project中

另:我的建议是楼主最好是去作wap处理,而不是mail处理,在larbin中加入wap的协议处理也许更有价值,也许还有商 ...


非常感谢你的建议,因为我这里是演示原理,所以根本没考虑其它东西。  :(
wap协议我也很有兴趣,应该不久会研究到。
但我缺少商业头脑,只能等哪天兴趣来了再抬头把所有研究的东西商业化一下。

Anyway, thanks a lot!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP