随笔分类 - 爬虫
摘要:1 # -*- coding:utf-8 -*- 2 import urlparse 3 import urllib2 4 from bs4 import BeautifulSoup 5 6 url = "http://www.baidu.com" 7 8 urls = [url] # stack of urls to scrape 9 visited =...
阅读全文
摘要:1.代码如下: doubanmoive.py items.py 2.在管道文件中更改储存位置 3.新建中间件 middlewares.py 进行反反爬虫 4.setting的设置
阅读全文
摘要:1.用 scrapy 新建一个 sun0769 项目 scrapy startproject sun0769 2.在 items.py 中确定要爬去的内容 3.快速创建 CrawlSpider模板 scrapy genspider -t crawl dongguan wz.sun0769.com 注
阅读全文
摘要:1.用 scrapy 新建一个 tencent 项目 2.在 items.py 中确定要爬去的内容 3.快速创建 CrawlSpider模板 scrapy genspider -t crawl tencent_spider tencent.com 注意 此时中的名称不能与项目名相同 4.打开tenc
阅读全文
摘要:1.用 scrapy 新建一个 tencent 项目 2.在 items.py 中确定要爬去的内容 1 # -*- coding: utf-8 -*- 2 3 # Define here the models for your scraped items 4 # 5 # See documentat
阅读全文
摘要:1.进入setting中把ITEM_piplines文件注销去掉 2.在piplines中写好代码 3.注意 在主文件中不用return, 用yield.
阅读全文
摘要:1.打开pycharm, 点击File>Open找到mySpider项目导入 . 2.打开File>Settings>Project 点击Project Interpreter 右边有个Scrapy, 选中确定. 3.在spiders文件下新建一个启动文件,我命名为start.py 4.选择conf
阅读全文

浙公网安备 33010602011771号