scrapy shell

2019-12-06

# Windows中:在黑屏终端下输入scrapy shell "网址"
# 可以在爬取数据时,在shell环境中,进行交互式的路径分析,方便实验
'''
启动shell后,会自动把网页代码下载下来,下载后的内容保存在response的变量中,如果需要,我们需要调用response
response:
    response.body:body是网页的代码
    response.headers:返回的是http的头信息
    response.xpath():允许使用xpath语法选择内容
    response.css():允许使用css语法选取内容
    response.body:
    response.body:
selector:
    选择器,允许用户使用选择器来选择自己想的内容
    response.selector.xpath() response.xpath是selector.xpath的快捷方式
    response.selector.css() response.css是他的快捷方式
    selector.extract:把节点内容用unicode形式返回
    selector.re:允许用户通过正则选取内容
'''

{/if}