|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
如题
上网百度了,还是一知半解
scrapy框架中
from scrapy.http.response.html import HtmlResponse
中HtmlResponse的作用是什么
如下行代码
- #driver.current_url 使用selenium模块 获取当前页面url
- #driver.page_source 使用selenium模块 获取页面数据
- #request <200 <200 https://www.网址>>
- response = HtmlResponse(url=self.driver.current_url,body=source,request=request,encoding='utf-8')
复制代码
其中的参数都能看得懂,就HtmlResponse不知道是用来干什么的求教
driver.page_source是获取到了网页源代码,但是不能从中提取数据,所以要进行转换成HtmlResponse对象,相当于再进行一次请求,对响应进行处理,比如xpath,提取数据!
|
|