# crawler **Repository Path**: ceagle/crawler ## Basic Information - **Project Name**: crawler - **Description**: crawler - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-16 - **Last Updated**: 2024-07-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # crawler #### 介绍 crawler #### 软件架构 软件架构说明 ```shell scrapy_demo # 项目所在文件夹, 建议用pycharm打开该文件夹 ├── scrapy.cfg # scrapy项目配置信息,不要删它,别动它,善待它. └── scrapy_demo # 项目跟目录 ├── __init__.py ├── items.py # 封装数据的格式 ├── middlewares.py # 所有中间件 ├── pipelines.py # 所有的管道 ├── settings.py # 爬虫配置信息 └── spiders # 爬虫文件夹, 稍后里面会写入爬虫代码 └── __init__.py ``` #### 安装教程 - 新建数据解析项目: - 创建工程:scrapy startproject 项目名称 - cd 项目名称 - 创建爬虫文件:scrapy genspider 爬虫文件名 www.xxx.com - 配置文件的修改:settings.py - 不遵从robots协议:ROBOTSTXT_OBEY = False - 指定输出日志的类型:LOG_LEVEL = 'ERROR' - 指定UA:USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36' #### install ```shell pip install scrapy scrapy startproject scrapy_demo cd scrapy_demo scrapy genspider first www.first.com ``` #### 运行项目 ```shell scrapy crawl first scrapy crawl first --nolog ``` ####配置文件修改:settings.py - 不遵从robots协议:ROBOTSTXT_OBEY = False - 指定输出日志的类型:LOG_LEVEL = 'ERROR' - 指定UA:USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36' #### pep8 ```bash pip install autopep8 ``` # create duanzi prj ```shell scrapy startproject duanzi_prj cd duanzi_prj scrapy genspider duanzi duanzi.com ``` #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)