![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python 爬虫
aspiring123
这个作者很懒,什么都没留下…
展开
-
爬取糗事百科[文字]栏前十页
import urllib.requestimport redef jokeCrawer(url): headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.3.4000 Chrome/30.0...原创 2018-08-02 19:19:22 · 171 阅读 · 0 评论 -
windows10安装scrapy时报错:error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual ...
在我正常使用pip安装scrapy时出现的错误: building 'twisted.test.raiser' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft...原创 2018-10-07 18:11:41 · 284 阅读 · 0 评论 -
使用seleinum爬取网易云音乐中iframe嵌入式框架内的排行榜的音乐
相对于其他静态网页常规爬虫,iframe嵌入式导致我们无法直接获取iframe内的数据,因此,我使用了seleinum中的.switch_to.frame()方法 直接定位到对应的iframe内,便可以直接爬取数据了。下面我就直接展示全部代码了,主要逻辑思维,我都有注释:# author:aspiringfrom selenium import webdriverimpo...原创 2018-10-07 15:24:47 · 1254 阅读 · 0 评论 -
使用seleinum模块动态爬取熊猫直播平台全部的主播房间。
爬取熊猫平台的数据也是使用面向对象的思想,和同样的逻辑思维,可以借鉴一下这种逻辑思维。至于解析可以参看我的这一篇博客:https://blog.csdn.net/qq_39198486/article/details/82950583如果使用seleinum模块时不会配置chromedriver文件,可以参考这篇博客:https://blog.csdn.net/qq_39198486/arti...原创 2018-10-06 20:31:35 · 786 阅读 · 0 评论 -
使用selenium时出现 " FileNotFoundError: [WinError 2] 系统找不到指定的文件。" 的解决办法。
在使用python的selenium模块模拟浏览器登录,使用的下面的代码#author: aspiringfrom selenium import webdriver# 实例化一个浏览器driver = webdriver.Chrome()# 发送请求driver.get("http://www.baidu.com/")然后出现了如下的错误 : Traceback ...原创 2018-10-03 09:40:35 · 17287 阅读 · 1 评论 -
使用python的requests、xpath和多线程爬取糗事百科的段子
代码主要使用的python中的requests模块、xpath功能和threading多线程爬取了糗事百科中段子的内容、图片和阅读数、段子作者的性别,年龄和头像。# author: aspiringimport requestsfrom lxml import etreeimport jsonimport threadingfrom queue import Queuecla...原创 2018-10-02 20:19:21 · 447 阅读 · 0 评论 -
使用python中的requests爬取百度翻译实现中英互译功能
话不多说,直接上代码 # coding=utf-8import requestsimport jsonimport sysclass BaiduFanyi: def __init__(self, tran_str): self.tran_str = tran_str self.lang_detect_url = "https://fanyi...原创 2018-09-17 22:29:11 · 3078 阅读 · 3 评论 -
抓取豆瓣电影网页动态Ajax请求的数据
import urllib.requestimport sslimport jsondef ajaxCrawler(url): headers = { "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.3.4000 ...原创 2018-08-08 10:19:47 · 1123 阅读 · 0 评论 -
python urllib模拟浏览器请求 爬虫
import urllib.requestimport randomurl = "http://www.baidu.com""""方式1# 模拟请求头headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "X原创 2018-08-08 09:46:56 · 1207 阅读 · 0 评论 -
Scrapy报错:no module named win32api 的解决方法以及虚拟环境下的解决方法
在第一次使用scrapy框架写爬虫时 运行项目scrapy crawl demo(爬虫名,自定)出现运行错误:错误的原因在于缺少win32pi模块解决方法: 一、在单纯的系统环境下,进入这个网址:https://sourceforge.net/projects/pywin32/files/pywin32/,随便选择一个你看着顺眼的Bulid,点击一个适合你版本的pywin32文件下...原创 2018-10-07 20:09:58 · 608 阅读 · 0 评论