<!--
*** Thanks for checking out the Best-README-Template. If you have a suggestion
*** that would make this better, please fork the repo and create a pull request
*** or simply open an issue with the tag "enhancement".
*** Thanks again! Now go create something AMAZING! :D
-->
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/BaiduSpider/BaiduSpider">
<img src="https://baiduspider.github.io/assets/logo.png" alt="Logo" width="80" height="80">
</a>
<h3 align="center">BaiduSpider</h3>
<p align="center">
一个爬取百度的利器
<br />
<span>简体中文</span>
|
<a href="https://github.com/BaiduSpider/BaiduSpider/blob/dev/README-zh-tw.md"><strong>繁體中文</strong></a>
|
<a href="https://github.com/BaiduSpider/BaiduSpider/blob/dev/README-en.md"><strong>English</strong></a>
<br />
<a href="https://baiduspider.github.io/"><strong>快速上手 »</strong></a>
<br />
<br />
<a href="https://baiduspider.github.io/usage/get-started/">查看示例</a>
·
<a href="https://github.com/BaiduSpider/BaiduSpider/issues">报告问题</a>
·
<a href="https://github.com/BaiduSpider/BaiduSpider/issues">请求需求</a>
</p>
</p>
<!-- TABLE OF CONTENTS -->
<details open="open">
<summary>目录</summary>
<ol>
<li>
<a href="#关于本项目">关于本项目</a>
<ul>
<li><a href="#依赖库">依赖库</a></li>
</ul>
</li>
<li>
<a href="#起步">起步</a>
<ul>
<li><a href="#预先条件">预先条件</a></li>
<li><a href="#安装">安装</a></li>
</ul>
</li>
<li><a href="#简单使用">简单使用</a></li>
<li><a href="#项目路线图">项目路线图</a></li>
<li><a href="#项目共建">项目共建</a></li>
<li><a href="#开源协议">开源协议</a></li>
<li><a href="#联系方式">联系方式</a></li>
<li><a href="#免责声明">免责声明</a></li>
<li><a href="#贡献者">贡献者</a></li>
<li><a href="#致谢">致谢</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## 关于本项目
[![项目截图][product-screenshot]](https://baiduspider.github.io)
搜索引擎是一个十分强大的工具,如果能让其他工具集成搜索引擎的众多强大功能,那么这些工具必将变得更加强大。但目前我没有找到一个可以精准提取搜索引擎搜索结果的开源爬虫。于是,我便编写了这个爬取百度搜索引擎的项目:BaiduSpider。
BaiduSpider的独特功能:
* 节省提取数据的时间,对于类似深度学习项目的数据模型建立与训练起到了良好的帮助。
* 精准提取数据,并删除广告。
* 搜索结果大而全,支持多种搜索类型,支持多种返回类型。
当然,没有一个项目是完美的。任何一个项目的发展都需要社区的帮助。你可以通过发布 Issue 或提交 PR 来帮助 BaiduSpider 进步!:smile:
一些比较有帮助的文档或工具将在最后的致谢部分中列出。
### 依赖库
一些 BaiduSpider 使用的主要开源依赖库。
* [BeautifulSoup 4](https://www.crummy.com/software/BeautifulSoup/)
* [requests](https://docs.python-requests.org/zh_CN/latest/)
<!-- GETTING STARTED -->
## 起步
为了安装 BaiduSpider,请按照以下几个步骤操作。
### 预先条件
在安装 BaiduSpider 之前,请确保你安装了`Python3.6+`:
```sh
$ python --version
```
若版本小于`3.6.0`,请到[Python官网](https://www.python.org/downloads/)下载并安装 Python。
### 安装
#### 使用`pip`安装
请在命令行中键入:
```sh
$ pip install baiduspider
```
#### 从 GitHub 手动安装
```sh
$ git clone git@github.com:BaiduSpider/BaiduSpider.git
# ...
$ python setup.py install
```
<!-- USAGE EXAMPLES -->
## 简单使用
你可以使用以下代码,通过 BaiduSpider 获取百度的网页搜索结果:
```python
# 导入BaiduSpider
from baiduspider import BaiduSpider
from pprint import pprint
# 实例化BaiduSpider
spider = BaiduSpider()
# 搜索网页
pprint(spider.search_web(query='Python'))
```
_更多样例和配置,请参照[文档](https://baiduspider.github.io)_
<!-- ROADMAP -->
## 项目路线图
请参考[Opening Issues](https://github.com/BaiduSpider/BaiduSpider/issues)以获取最新的项目规划以及已知问题。
<!-- CONTRIBUTING -->
## 项目共建
社区的贡献是开源项目的灵魂所在,也是整个开源社区学习、交流、获得灵感的方式。我们**极力欢迎**任何人参与本项目的开发与维护。
具体参与步骤如下:
1. For k此项目
2. 创建 Feature 分支 (`git checkout -b NewFeatures`)
3. 在每次修改代码后,提交你的更改 (`git commit -m 'Add some AmazingFeature'`)
4. 将更改推送到自己的远程仓库 (`git push origin username/BaiduSpider`)
5. 在 GitHub 上打开你的仓库,根据指引提交 PR
<!-- LICENSE -->
## 开源协议
本项目基于`GPL-V3`开源,详情请参见`LICENSE`。
<!-- CONTACT -->
## 联系方式
samzhangjy - [@samzhangjy](https://twitter.com/samzhangjy) - samzhang951@outlook.com
项目链接: [https://github.com/BaiduSpider/BaiduSpider](https://github.com/BaiduSpider/BaiduSpider)
## 免责声明
此项目仅作为学习用途,不可商用或用于爬取百度大量数据。此外,本项目使用`GPL-V3`版权协议,意味着涉及(使用)此项目的任何其它项目必须开源且注明出处,并且本项目作者不承担滥用导致的任何法律风险。特此说明,违者后果自负。
## 贡献者
<a href="https://github.com/baiduspider/baiduspider/graphs/contributors">
<img src="https://contrib.rocks/image?repo=baiduspider/baiduspider" />
</a>
<!-- ACKNOWLEDGEMENTS -->
## 致谢
* [BeautifulSoup 4](https://www.crummy.com/software/BeautifulSoup/)
* [Requests](https://docs.python-requests.org/zh_CN/latest/)
* [Img Shields](https://shields.io)
* [Gitmoji](https://gitmoji.dev/)
* [Best-README-Template](https://github.com/othneildrew/Best-README-Template)
* [Choose an Open Source License](https://choosealicense.com)
* [GitHub Pages](https://pages.github.com)
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/BaiduSpider/BaiduSpider?style=for-the-badge
[contributors-url]: https://github.com/BaiduSpider/BaiduSpider/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/BaiduSpider/BaiduSpider?style=for-the-badge
[forks-url]: https://github.com/BaiduSpider/BaiduSpider/network/members
[stars-shield]: https://img.shields.io/github/stars/BaiduSpider/BaiduSpider?style=for-the-badge
[stars-url]: https://github.com/BaiduSpider/BaiduSpider/stargazers
[issues-shield]: https://img.shields.io/github/issues/BaiduSpider/BaiduSpider?style=for-the-badge
[issues-url]: https://github.com/BaiduSpider/BaiduSpider/issues
[license-shield]: https://img.shields.io/github/license/BaiduSpider/BaiduSpider?style=for-the-badge
[license-url]: https://github.com/BaiduSpider/BaiduSpider/blob/master/LICENSE
[product-screenshot]: https://i.loli.net/2021/04/22/V7gGrmTDlfR5U24.png
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
目前支持百度网页搜索,百度图片搜索,百度知道搜索,百度视频搜索,百度资讯搜索,百度文库搜索,百度经验搜索和百度百科搜索。 爬虫(Web Crawler)是一种自动化程序,用于从互联网上收集信息。其主要功能是访问网页、提取数据并存储,以便后续分析或展示。爬虫通常由搜索引擎、数据挖掘工具、监测系统等应用于网络数据抓取的场景。 爬虫的工作流程包括以下几个关键步骤: URL收集: 爬虫从一个或多个初始URL开始,递归或迭代地发现新的URL,构建一个URL队列。这些URL可以通过链接分析、站点地图、搜索引擎等方式获取。 请求网页: 爬虫使用HTTP或其他协议向目标URL发起请求,获取网页的HTML内容。这通常通过HTTP请求库实现,如Python中的Requests库。 解析内容: 爬虫对获取的HTML进行解析,提取有用的信息。常用的解析工具有正则表达式、XPath、Beautiful Soup等。这些工具帮助爬虫定位和提取目标数据,如文本、图片、链接等。 数据存储: 爬虫将提取的数据存储到数据库、文件或其他存储介质中,以备后续分析或展示。常用的存储形式包括关系型数据库、NoSQL数据库、JSON文件等。 遵守规则: 为避免对网站造成过大负担或触发反爬虫机制,爬虫需要遵守网站的robots.txt协议,限制访问频率和深度,并模拟人类访问行为,如设置User-Agent。 反爬虫应对: 由于爬虫的存在,一些网站采取了反爬虫措施,如验证码、IP封锁等。爬虫工程师需要设计相应的策略来应对这些挑战。 爬虫在各个领域都有广泛的应用,包括搜索引擎索引、数据挖掘、价格监测、新闻聚合等。然而,使用爬虫需要遵守法律和伦理规范,尊重网站的使用政策,并确保对被访问网站的服务器负责。
资源推荐
资源详情
资源评论
收起资源包目录
BaiduSpider,一个爬取百度搜索结果的爬虫.zip (107个子文件)
main.css 6KB
extra.css 298B
.gitignore 234B
main.html 543B
main.js 50KB
LICENSE 34KB
README-en.md 8KB
README.md 8KB
README-zh-tw.md 8KB
index.md 8KB
wenku.md 5KB
index.md 4KB
web.md 4KB
index.md 3KB
CODE_OF_CONDUCT.md 2KB
news.md 2KB
zhidao.md 2KB
jingyan.md 2KB
CONTRIBUTING.md 1KB
web.md 1KB
pic.md 1KB
video.md 1016B
baike.md 745B
bug_report.md 515B
feature_request.md 430B
pull_request_template.md 290B
pull_request_template.md 290B
__init__.md 172B
index.md 161B
__init__.md 160B
util.md 140B
typings_web.md 118B
__init__.md 118B
typings_jingyan.md 115B
typings_zhidao.md 114B
typings_video.md 113B
typings_baike.md 113B
typings_wenku.md 113B
typings_news.md 112B
typings_web.md 111B
typings_pic.md 111B
__init__.md 110B
subparser.md 108B
__init__.md 103B
web.md 102B
subparser.md 101B
__init__.md 100B
__init__.md 100B
__init__.md 100B
jingyan.md 99B
zhidao.md 98B
video.md 97B
baike.md 97B
wenku.md 97B
_spider.md 96B
news.md 96B
web.md 95B
pic.md 95B
__init__.md 93B
banner-transparent.png 129KB
banner.png 125KB
logo.png 122KB
logo-dark.png 92KB
logo-light.png 78KB
__init__.py 44KB
__init__.py 28KB
web.py 19KB
web.py 19KB
subparser.py 14KB
subparser.py 11KB
__init__.py 9KB
generate_typings.py 6KB
typings_web.py 6KB
typings_web.py 6KB
_spider.py 5KB
__init__.py 4KB
jingyan.py 4KB
wenku.py 4KB
util.py 4KB
__init__.py 3KB
zhidao.py 3KB
video.py 3KB
news.py 2KB
baike.py 2KB
pic.py 2KB
__init__.py 2KB
typings_jingyan.py 1KB
typings_wenku.py 1KB
typings_zhidao.py 1009B
setup.py 946B
typings_video.py 933B
typings_news.py 913B
__init__.py 880B
typings_baike.py 838B
typings_pic.py 767B
__init__.py 643B
__init__.py 247B
__init__.py 247B
__init__.py 0B
__init__.py 0B
共 107 条
- 1
- 2
资源评论
- qw_69189660112024-03-26发现一个宝藏资源,资源有很高的参考价值,赶紧学起来~
JJJ69
- 粉丝: 5965
- 资源: 5593
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功