scrapy是什么?
scrapy是一个爬取结构化数据的框架,它不是一个简单的模块,它里面有很多针对爬虫需要而开发的模块。(结构化数据,一般有json文件,xml文件。如果想要将json文件,转化成python类型使用json.load();如果想将提取xml文件里面的内容,比如文本内容,一般用xpath来提取。)
response = response.get(url,headers=headers)
html = etree.HTML(response.content) # 此时得到的html是一个element对象
content = html.xpath(‘这里面是xpath语法’)