代码将下载此页面并将其保存在文件中
download-a-full-page-with-scrapy.html
test_scr.py
import scrapyclass TestSpider(scrapy.Spider): name = "test" start_urls = [ "http://stackoverflow.com/questions/38233614/download-a-full-page-with-scrapy", ] def parse(self, response): filename = response.url.split("/")[-1] + '.html' with open(filename, 'wb') as f: f.write(response.body)
scrapy runspider test_scr.py
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)