摘要:
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
运维爱背锅
阅读(20)
评论(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
运维爱背锅
阅读(120)
评论(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
运维爱背锅
阅读(38)
评论(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
运维爱背锅
阅读(28)
评论(0)
推荐(0)
摘要:
# 创建项目 **执行命令** ```Bash scrapy startproject ``` # **项目结构** 
评论(0)
推荐(0)
摘要:
 阅读全文
posted @ 2023-07-17 11:32
运维爱背锅
阅读(24)
评论(0)
推荐(0)
摘要:
有些网站时一直滚动就会加载新数据的,在selenium中解决方法: ```Python def loaddata_by_scroll(self, driver): js = 'return document.body.scrollHeight;' # 获取当前高度 check_height = dr 阅读全文
posted @ 2023-07-17 11:30
运维爱背锅
阅读(295)
评论(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
运维爱背锅
阅读(685)
评论(0)
推荐(0)
摘要:
[https://www.selenium.dev/documentation/webdriver/waits/](https://www.selenium.dev/documentation/webdriver/waits/) 有时候我们需要等待网页上的元素出现后才能操作。selenium中可以使 阅读全文
posted @ 2023-07-17 11:28
运维爱背锅
阅读(221)
评论(0)
推荐(0)
摘要:
无头模式适合的场景: - 部署到没有gui界面的服务器,比如linux - 开发环境测试完全没问题后可以使用无头模式,提高selenium速度。 ```YAML # 使用headless无界面浏览器模式 chrome_options.add_argument('--headless') chrome 阅读全文
posted @ 2023-07-17 11:28
运维爱背锅
阅读(475)
评论(1)
推荐(0)