摘要: 参考官方文档:[https://docs.scrapy.org/en/latest/topics/jobs.html?highlight=JOBDIR#jobs-pausing-and-resuming-crawls](https://docs.scrapy.org/en/latest/topics 阅读全文
posted @ 2023-07-17 11:39 蕝戀 阅读(304) 评论(0) 推荐(0) 编辑
摘要: CrawlSpider类型的爬虫会根据指定的rules规则自动找到url比自动爬取。 优点:适合整站爬取,自动翻页爬取 缺点:比较难以通过meta传参,只适合一个页面就能拿完数据的。 ```Python import scrapy from scrapy.http import HtmlRespon 阅读全文
posted @ 2023-07-17 11:38 蕝戀 阅读(10) 评论(0) 推荐(0) 编辑
摘要: num = 0 ```Python import scrapy from scrapy.http import HtmlResponse from scrapy_demo.items import DoubanItem """ 这个例子主要是学习meta传参。 """ class DoubanSpi 阅读全文
posted @ 2023-07-17 11:36 蕝戀 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 假设我们在settings.py定义了一个IP地址池 ```Bash ##### 自定义设置 IP_PROXY_POOL = ( "127.0.0.1:6789", "127.0.0.1:6789", "127.0.0.1:6789", "127.0.0.1:6789", ) ``` 要在爬虫文件中 阅读全文
posted @ 2023-07-17 11:36 蕝戀 阅读(86) 评论(0) 推荐(0) 编辑
摘要: ```Python # Scrapy settings for scrapy_demo project # # For simplicity, this file contains only settings considered important or # commonly used. You 阅读全文
posted @ 2023-07-17 11:35 蕝戀 阅读(20) 评论(0) 推荐(0) 编辑
摘要: ```Python import scrapy from scrapy.http.request import Request from scrapy.http.response.html import HtmlResponse from scrapy_demo.items import Forum 阅读全文
posted @ 2023-07-17 11:34 蕝戀 阅读(6) 评论(0) 推荐(0) 编辑
摘要: # 创建项目 **执行命令** ```Bash scrapy startproject ``` # **项目结构** ![](https://secure2.wostatic.cn/static/dkJyXRT5EDBrNskNyzpNyY/image.png?auth_key=1689564783 阅读全文
posted @ 2023-07-17 11:33 蕝戀 阅读(29) 评论(0) 推荐(0) 编辑
摘要: ![](https://secure2.wostatic.cn/static/6mSAqCGta7HpNwgYGG5D13/image.png?auth_key=1689564711-ucXZC28uz1CritVB5QTEff-0-46f7c0a9a3589af32224146e59889692) 阅读全文
posted @ 2023-07-17 11:32 蕝戀 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 有些网站时一直滚动就会加载新数据的,在selenium中解决方法: ```Python def loaddata_by_scroll(self, driver): js = 'return document.body.scrollHeight;' # 获取当前高度 check_height = dr 阅读全文
posted @ 2023-07-17 11:30 蕝戀 阅读(211) 评论(0) 推荐(0) 编辑
摘要: ```Python """ P.S:需要接管现有浏览器 ** 使用步骤: 1、打开浏览器,设置好远程调试端口,并扫描登录淘宝。 chrome.exe --remote-debugging-port=9333 --user-data-dir="G:\spider_taobao"** 2、运行程序,自动 阅读全文
posted @ 2023-07-17 11:29 蕝戀 阅读(432) 评论(0) 推荐(0) 编辑