
爬虫
LittleDragorse
有任何问题可以留言,我们共同进步!
展开
-
PythonHTML解析
目录BeautifulSoup基础方法基本元素TagNameAttributesNavigableStringComment下行遍历tag.contentstag.childrentag.descendants上行遍历tag.parenttag.parents访问平行节点tag.next_siblingtag.next_...原创 2019-04-25 19:51:06 · 799 阅读 · 0 评论 -
Python爬虫反反爬总结
针对以下各反爬手段的反制措施Headers最基本的反爬手段,一般被关注的变量是UserAgent和Refer,可以考虑使用浏览器里的。其中的ContentLength字段requests包会填写,可以不用。Content-Type字段是post表单的格式,必须和网站的一样。UA待续拉黑高频访问IP数据量大用IP池(伪装成多个访问者),爬取速度要求低用sleep()(伪装成人...原创 2019-04-25 15:06:28 · 454 阅读 · 0 评论 -
re库的使用及正则表达式
常用正则表达式from re import compilepercent = 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 · 307 阅读 · 0 评论 -
Scrapy爬虫框架学习
目录五大模块DownloaderSpiderItemPipelineScheduleEngine四个配置参数三个对象scrapy.http.Request常用属性常用方法Response常用属性常用方法Item两类中间件DownloaderMiddlewareSpiderMiddleware五大模块Downloa...原创 2019-04-29 01:28:07 · 157 阅读 · 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 · 207 阅读 · 0 评论