![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
urllib与反爬策略
Dcy_ASK
预测未来最好的方式是创造
展开
-
xpath获取到的为空
通过运行如下代码,返回的是一个空列表# 模拟用户登录csdn学院,查看到该用户购买的课程,并拿到已经购买的课程名称# 对已登录用户的已购买课程的request url进行分析# 然后创建一个request,向该网站发送request请求# request请求得到响应url,# response的内容是一个url对象# 将url对象转换为python对象# 本地操作该python对象,并存储到本地,以HTML形式# 将response的内容存放在本地、存放为一个静态的HTML文件impor原创 2020-10-04 22:30:14 · 2103 阅读 · 1 评论 -
scrapy 爬取空值
DEBUG: Redirecting (301) to <GET https://edu.csdn.net/> from <GET http://edu.csdn.net>import scrapyclass S1Spider(scrapy.Spider): name = 's1' # 爬虫的名字 allowed_domains = ['blog.csdn.net'] # 如果URL地址的HOST不属于allowed_domains,则过滤掉该请求原创 2020-10-03 09:10:11 · 1615 阅读 · 0 评论 -
XHR>>name不显示sug
调用Google控制台name中不显示sug,如图所示换了IE浏览器能够出现,问了群里的大佬,大佬给出:当初逆向了js,后来就发现,谷歌浏览器确实没有,语言逆向js解析破解反扒。但是换成电脑自带的ie浏览器就有,因此换成ie的useragent就可以直接爬,更换IE后,确实出现,感谢...原创 2020-10-01 22:16:48 · 2113 阅读 · 4 评论 -
AttributeError: lxml.etree._Element object has no attribute xpth
AttributeError: lxml.etree._Element object has no attribute xpthimport lxml.etree as le# 分析 xpath 语句,提取1级分类# xpath1=xpth('//div[@class="floor-container popular_recommend"]/text()')# 继续分析 HTML结构,提取2级分类# xpath2=xpath('//div[@class="floor-container popu原创 2020-10-01 17:06:15 · 9722 阅读 · 5 评论 -
FileNotFoundError: [Errno 2] No such file or directory: ‘blog/Java学习的正确打开方式.html‘
FileNotFoundError: [Errno 2] No such file or directory: ‘blog/Java学习的正确打开方式.html’import urllib.request as urimport lxml.etree as leurl = 'https://so.csdn.net/so/search/s.do?q={keyword}&t=all&platform=pc&p={page}&s=&tm=&v=&l=原创 2020-10-01 06:33:31 · 723 阅读 · 0 评论