摘 要网 络 爬 虫 是 一 种 自 动 搜 集 互 联 网 信 息 的 程序 。 通 过 网 络 爬 虫 不 仅 能 够 为 搜 索 引 擎 采 集网 络 信 息 , 而 且 可 以 作 为 定 向 信 息 采 集 器 , 定向 采 集 某 些 网 站 下 的 特 定 信 息 , 如 招 聘 信 息,租 房 信 息 等 .本 文 通 过 JAVA实 现 了 一 个 基 于 广 度 优 先 算 法的 多 线 程 爬 虫 程 序 . 本 论 文 阐 述 了 网 络 爬 虫 实现 中 一 些 主 要 问 题 : 为 何 使 用 广 度 优 先 的 爬行 策 略 , 以 及 如 何 实 现 广 度 优 先 爬 行 ; 为 何要 使 用 多 线 程 , 以 及 如 何 实 现 多 线 程 ; 系 统 实现 过 程 中 的 数 据 存 储 ; 网 页 信 息 解 析 等 。通 过 实 现 这 一 爬 虫 程 序 , 可 以 搜 集 某 一 站点 的 URLs,并 将 搜 集 到 的 URLs 存 入 数 据 库 。 【 关 键 字 】 网 络 爬 虫 ;JAVA; 广 度 优 先; 多 线程 .ABSTRACT SPIDER is a program which can auto collect informations from internet. SPIDER can collect data for search engines, also can be a Directional information collector, collects specifically informations from some web sites, such as HR informations , house rent informations。In this paper , use JAVA implements a breadth—first algorithm multi—thread SPDIER。 This paper expatiates some major problems of SPIDER : why to use breadth-first crawling strategy, and how to implement breadth—first crawling; why to use multi—threading, and how to implement multi—thread; data structure ; HTML code parse 。 etc. This SPIDER can collect URLs from one web site , and store URLs into database。 【KEY WORD】SPIDER; JAVA; Breadth First Search; multi-threads 。目录第 一 章 引 言 .............................................1第 二 章 相 关 技 术 介 绍 ................................ 2...