摘要:
num = 0 ```Python import scrapy from scrapy.http import HtmlResponse from scrapy_demo.items import DoubanItem """ 这个例子主要是学习meta传参。 """ class DoubanSpi 阅读全文
摘要:
假设我们在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", ) ``` 要在爬虫文件中 阅读全文
摘要:
```Python # Scrapy settings for scrapy_demo project # # For simplicity, this file contains only settings considered important or # commonly used. You 阅读全文
摘要:
```Python import scrapy from scrapy.http.request import Request from scrapy.http.response.html import HtmlResponse from scrapy_demo.items import Forum 阅读全文
摘要:
# 创建项目 **执行命令** ```Bash scrapy startproject ``` # **项目结构** ![](https://secure2.wostatic.cn/static/dkJyXRT5EDBrNskNyzpNyY/image.png?auth_key=1689564783 阅读全文
摘要:
![](https://secure2.wostatic.cn/static/6mSAqCGta7HpNwgYGG5D13/image.png?auth_key=1689564711-ucXZC28uz1CritVB5QTEff-0-46f7c0a9a3589af32224146e59889692) 阅读全文
摘要:
有些网站时一直滚动就会加载新数据的,在selenium中解决方法: ```Python def loaddata_by_scroll(self, driver): js = 'return document.body.scrollHeight;' # 获取当前高度 check_height = dr 阅读全文
摘要:
```Python """ P.S:需要接管现有浏览器 ** 使用步骤: 1、打开浏览器,设置好远程调试端口,并扫描登录淘宝。 chrome.exe --remote-debugging-port=9333 --user-data-dir="G:\spider_taobao"** 2、运行程序,自动 阅读全文
摘要:
[https://www.selenium.dev/documentation/webdriver/waits/](https://www.selenium.dev/documentation/webdriver/waits/) 有时候我们需要等待网页上的元素出现后才能操作。selenium中可以使 阅读全文
摘要:
无头模式适合的场景: - 部署到没有gui界面的服务器,比如linux - 开发环境测试完全没问题后可以使用无头模式,提高selenium速度。 ```YAML # 使用headless无界面浏览器模式 chrome_options.add_argument('--headless') chrome 阅读全文