![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
LittleDragorse
有任何问题可以留言,我们共同进步!
展开
-
PythonHTML解析
目录 BeautifulSoup 基础方法 基本元素 Tag Name Attributes NavigableString Comment 下行遍历 tag.contents tag.children tag.descendants 上行遍历 tag.parent tag.parents 访问平行节点 tag.next_sibling tag.next_...原创 2019-04-25 19:51:06 · 726 阅读 · 0 评论 -
Python爬虫反反爬总结
针对以下各反爬手段的反制措施 Headers 最基本的反爬手段,一般被关注的变量是UserAgent和Refer,可以考虑使用浏览器里的。其中的ContentLength字段requests包会填写,可以不用。Content-Type字段是post表单的格式,必须和网站的一样。 UA 待续 拉黑高频访问IP 数据量大用IP池(伪装成多个访问者),爬取速度要求低用sleep()(伪装成人...原创 2019-04-25 15:06:28 · 378 阅读 · 0 评论 -
re库的使用及正则表达式
常用正则表达式 from re import compile percent = compile('([1-9]?[0-9]|100)%’) # 百分比 date = compile(r'20\d{2}-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])’) time = compile("([01]\d|2[0-3]):([0-5]\d):([0-5]\d)") w...原创 2019-04-25 00:11:39 · 253 阅读 · 0 评论 -
Scrapy爬虫框架学习
目录 五大模块 Downloader Spider ItemPipeline Schedule Engine 四个配置参数 三个对象 scrapy.http.Request 常用属性 常用方法 Response 常用属性 常用方法 Item 两类中间件 DownloaderMiddleware SpiderMiddleware 五大模块 Downloa...原创 2019-04-29 01:28:07 · 129 阅读 · 0 评论 -
Selenium使用总结
创建使用代理的无头浏览器 def get_driver(proxy={'ip': ip, 'port': port}): chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--proxy-server=h...原创 2019-05-30 18:10:37 · 163 阅读 · 0 评论