会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
市丸银
知行合一
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
66
67
68
69
70
71
72
73
74
···
100
下一页
2019年10月26日
Scrapy深度和优先级
摘要: 一、深度 配置文件 settings.py 二、优先级 配置文件 优先级为正数时,随着深度越大,优先级越低 源码中,优先级 三、源码分析 1、深度 前提:scrapy yield request对象 -> 中间件 ->调度器... yield Request对象没有设置meta的值,meta默认为N
阅读全文
posted @ 2019-10-26 16:29 市丸银
阅读(1456)
评论(0)
推荐(0)
2019年10月25日
Scrapy去重
摘要: 一、原生 1、模块 2、RFPDupeFilter方法 a、request_seen 核心:爬虫每执行一次yield Request对象,则执行一次request_seen方法 作用:用来去重,相同的url只能访问一次 实现:将url值变成定长、唯一的值,如果这个url对象存在,则返回True表名已
阅读全文
posted @ 2019-10-25 23:45 市丸银
阅读(761)
评论(0)
推荐(0)
2019年10月23日
Scrapy持久化(items+pipelines)
摘要: 一、items保存爬取的文件 items.py import scrapy class QuoteItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() text = scrapy
阅读全文
posted @ 2019-10-23 23:13 市丸银
阅读(353)
评论(0)
推荐(0)
Scrapy的基本使用
摘要: 爬取:http://quotes.toscrape.com 单页面 # -*- coding: utf-8 -*- import scrapy class QuoteSpider(scrapy.Spider): name = 'quote' allowed_domains = ['quotes.to
阅读全文
posted @ 2019-10-23 22:41 市丸银
阅读(187)
评论(0)
推荐(0)
2019年10月22日
scrapy框架安装及创建
摘要: 介绍:大而全的爬虫组件 使用Anaconda conda install -c conda-forge scrapy 一、安装: windows 1.下载 https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 耐心等待网页刷新 pip3 instal
阅读全文
posted @ 2019-10-22 22:47 市丸银
阅读(255)
评论(0)
推荐(0)
requests请求
摘要: requests:伪造浏览器请求 请求 1.get requests.get( url='', params={ 'k1': ''v1, 'k2': 'v2' } ) 即 url?k1=k2&k2=v2 2.post requests.post( url='', # data 提交的数据 data={key: value}, # 请求头 headeres={}, # cookies值需要从get请
阅读全文
posted @ 2019-10-22 15:28 市丸银
阅读(199)
评论(0)
推荐(0)
2019年10月19日
爬虫 简单使用
摘要: 一、常识 二、示例
阅读全文
posted @ 2019-10-19 22:37 市丸银
阅读(224)
评论(0)
推荐(0)
2019年10月10日
使用使用django-cors-headers解决跨域问题
摘要: 安装 注册App 添加中间件必须放在最前面,因为要先解决跨域的问题。只有允许跨域请求,后续的中间件才会正常执行。 配置你可以选择不限制跨域访问 或者你可以选择设置允许访问的白名单
阅读全文
posted @ 2019-10-10 20:29 市丸银
阅读(325)
评论(0)
推荐(0)
Django自定义状态码
摘要: class BaseResponse: def __init__(self): self.code = 1000 self.data = None self.error = None @property def dict(self): return self.__dict__
阅读全文
posted @ 2019-10-10 20:25 市丸银
阅读(1341)
评论(0)
推荐(0)
去除Linux中的^M
摘要: (1)安装tofrodos sudo apt-get install tofrodos (2)做一些优化 ln -s /usr/bin/todos /usr/bin/unix2dos ln -s /usr/bin/fromdos /usr/bin/dos2unix 第一种方法: cat -A filename 就可以看到Windows下的断元字符 ^M 要去除他,最简单用下面的命令: dos2un
阅读全文
posted @ 2019-10-10 11:50 市丸银
阅读(366)
评论(0)
推荐(0)
上一页
1
···
66
67
68
69
70
71
72
73
74
···
100
下一页
公告