![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬爬爬
乱写乱画
一个用来记录笔记的博客
展开
-
windows下python使用protobuf的开门级教程
转载自:https://blog.csdn.net/u013992365/article/details/81287041一、在windows下编译python所需的protobuf的相关文件1、首先下载protobuf源码(后一个是我自己从github上down的,因为版本是3.6.0,因为网不好下了很久,但是这个是完全体,就是我把包括python在内的全部版本都下了下来):https://github.com/google/protobuf/releases/tag/v3.6.0或是:http转载 2021-07-23 16:07:43 · 907 阅读 · 2 评论 -
is not clickable at point (530, 16). Other element would receive the click
使用selenium发送点击请求报错翻译了一下不能点击,被其他元素接受了请求解决方法1button.send_keys("\n") #方法2from selenium.webdriver.common.keys import Keysbutton.send_keys(Keys.SPACE) #方法3driver.execute_script("arguments[0].click();", button)经过gen...原创 2021-06-15 17:07:33 · 185 阅读 · 0 评论 -
ValueError: check_hostname requires server_hostname
python3 爬取数据时报错requests.get("https://www.baidu.com/", proxies={'http': 'http://183.53.29.159:25862', 'https': 'https://183.53.29.159:25862'})原创 2021-06-10 15:46:28 · 140 阅读 · 0 评论 -
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
http://npm.taobao.org/mirrors/chromedriver/89.0.4389.23/1,到这个地址下载浏览器对应的浏览器驱动2,将安装包解压代码指定驱动路径webdriver.Chrome(r'E:\ChromeDriver\chromedriver.exe', chrome_options=chrome_options)原创 2021-04-19 10:12:09 · 350 阅读 · 0 评论 -
微博 帖子转发下 json字段描述
{ "created_at": "Tue May 31 17:46:55 +0800 2011", # 创建时间 "id": 11488058246, # 微博id "text": "求关注。", # 微博信息内容 "source": "<a href="http://weibo.com" rel="nofollow">新浪微博</a>", # 微博来源 "favorited": false, # 是否已收藏 "truncated":.转载 2020-07-24 15:41:58 · 624 阅读 · 0 评论 -
python将中文字符转为浏览器传输格式%20,%3A
import urllib.parse as parseres = parse.quote("lang:ja until:2020-05-07 since:2020-05-06 ナルト", encoding="UTF-8")res'lang%3Aja%20until%3A2020-05-07%20since%3A2020-05-06%20%E3%83%8A%E3%83%AB%E3%83%88'res = parse.unquote('lang%3Aja%20until%3A2020-05-07%2.原创 2020-05-20 15:22:00 · 1282 阅读 · 0 评论 -
BeautifulSoup正则匹配
div_list = soup_obj.find_all("div", {"data-testid": re.compile(r"position: absolute;.*?;")})原创 2020-05-20 10:57:50 · 670 阅读 · 0 评论 -
python 多线程读写MySQL
import pymysqlimport threadingimport datetimeimport randomimport requestsimport jsonimport reimport timeclass DB(object): """创建MySQL实例""" def __init__(self, host=None, username=None,...原创 2020-04-30 15:56:31 · 1097 阅读 · 0 评论 -
将URL中 %开头字符串转为中文
import urllib.parse as parseres=parse.quote("没名字最可怕了",encoding="UTF-8")res2=parse.unquote("%E6%B2%A1%E5%90%8D%E5%AD%97%E6%9C%80%E5%8F%AF%E6%80%95%E4%BA%86",encoding="UTF-8")"""res'%E6%B2%A1%E...原创 2019-11-28 10:57:53 · 2643 阅读 · 0 评论 -
爬爬爬 —— beautifulsoup
Beautiful Soup是python的一个库,最主要的功能是从网页抓取数据,用法简单,但是效率比正则慢。创建soup对象:>>> import requests>>> from bs4 import BeautifulSoup>>> html = requests.get('http://bbs.tianya.cn/post...原创 2019-04-23 17:10:37 · 1126 阅读 · 0 评论 -
win 运行scrapy warring UserWarning: You do not have a working installation of the service_identity mo
win 怎么这么多问题啊。。。没安装这个service_identity包,安装一下pip install service_identity-17.0.0-py2.py3-none-any.whl安装完还是提示这个警告很大可能是有些包的版本不一样导致的,这个时候我们可以用下面这行代码来强制更新pip install service_identity --force --up...原创 2019-04-26 13:18:42 · 245 阅读 · 0 评论 -
win 安装scrapy报错 from cryptography.hazmat.bindings._openssl import ffi, lib ImportError: DLL load
解决方法来源:https://blog.csdn.net/tfun_zhang/article/details/83745614解决方法pip install -I cryptography转载 2019-04-26 10:27:27 · 3477 阅读 · 1 评论 -
爬爬爬--xpath
获取静态网页数据时,可以选择使用xpath,Beautifulsoup来提高工作效率XPath属于lxml库模块,所以首先要安装库lxmlXPath的使用方法:首先讲一下XPath的基本语法知识:四种标签的使用方法1)//双斜杠 定位根节点,会对全文进行扫描,在文档中选取所有符合条件的内容,以列表的形式返回。2)/单斜杠 寻找当前标签路径的下一层路径标签或者对当前...原创 2019-04-17 11:10:56 · 330 阅读 · 0 评论 -
爬爬爬——创建一个scrapy项目,爬取论坛
创建一个scrapy项目:scrapy startproject + 项目名(myworld) [root@web rxzWorld]# scrapy startproject tianyaNew Scrapy project 'tianya', using template directory '/root/.virtualenvs/myworld/lib/python3.6/si...原创 2019-04-17 11:08:07 · 224 阅读 · 0 评论 -
爬爬爬——了解scrapy框架工作流程
丧丧的春节过了,又到了学习的季节--熟悉scrapy框架为什么选择用框架: 不用重复造轮子,scrapy 底层是异步框架 twisted ,吞吐量高。1.scrapy 的基础概念: scrapy 是一个为了爬取网站数据,提取结构性数据而编写的应用框架,我们只需要实现少量代码,就能够快速的抓取到数据内容。Scrapy 使用了 Twisted['twɪstɪd](其主要对手是T...原创 2019-04-01 13:03:59 · 323 阅读 · 0 评论 -
爬爬爬,爬虫之数据提取——正则表达式
常见匹配模式:re.matchre.match尝试从字符串的起始位置匹配一个模式,如果不是起始位置匹配成功,则match()返回Nonere.match(pattern,string,flags=0)最常规的匹配import re>>> content = 'lu 156 156 shuai_ ke'>>> result = re...原创 2019-01-22 14:55:43 · 410 阅读 · 0 评论 -
爬爬爬,爬虫之获取数据——requests
推荐使用requests库,相比urllib使用要简介的多requests向目标站点发送请求,获得一个HTTPresponse响应import requestsrequests.get('http://httpbin.org/get')requests.post('http://httpbin.org/post')requests.put('http://httpbin.org/...原创 2019-01-22 15:51:00 · 2400 阅读 · 0 评论