![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
fengbansha
这个作者很懒,什么都没留下…
展开
-
认识爬虫(2)
用爬虫下载简单的页面,可以拿来练手import requestsclass TiebaSpider: def __init__(self,tieba_name_crawl): """ 初始化必要参数,完成基础设置 :param tieba_name_crawl: """ self.tieba_name =...原创 2018-12-19 17:26:21 · 139 阅读 · 0 评论 -
爬虫进阶(1)
import randomimport requestsfrom fake_useragent import UserAgentfrom retrying import retry # 装饰器 下载错误重复下载import hashlib # 信息摘要 md5import queue # 队列import re # 正则表达式from urllib import robotpa...原创 2018-12-20 11:40:33 · 136 阅读 · 0 评论 -
爬虫进阶(2)
网页解析test_data = """ <div> <ul> <li class="item-0"><a href="link1.html" id="places_neighbours__row">9,596,960first ite原创 2018-12-20 19:18:43 · 198 阅读 · 0 评论 -
Windows下安装Scrapy
安装Twisted模块在这里告诉大家一个方法安装Twisted模块的方法啊,首先需要先安装wheel模块,这回使用pip install wheel不会报错的,直接安装成功啦。之后打开命令行工具输入Python进入Python环境(也就是输入Python命令),看到我的Python版本是3.6.1的,去https://www.lfd.uci.edu/~gohlke/pythonlibs/#tw...原创 2018-12-27 10:25:03 · 143 阅读 · 0 评论 -
Python:安装whl文件
whl格式本质上是一个压缩包,里面包含了py文件,以及经过编译的pyd文件。使得可以在不具备编译环境的情况下,选择合适自己的python环境进行安装。安装方法很简单,进入命令行输入pip install xxxx.whl或者如果是升级pip install -U xxxx.whl如何安装whl文件步骤:1.用管理员方式打开cmd2.首先通过pip命令安装wheel如果提示’pip...原创 2018-12-27 10:28:56 · 3873 阅读 · 0 评论 -
Python运行scrapy报错:ImportError: No module named win32api
运行scrapy项目就报错:ImportError: No module named win32api 找不到win32api模块。。。解决方法运行命令安装模块: pip install pypiwin32原创 2018-12-27 10:31:54 · 214 阅读 · 0 评论 -
python 爬取简单的双色球走势图数据
import lxml.htmlimport requestsresponse = requests.get('http://trend.caipiao.163.com/ssq/').textresult = lxml.html.fromstring(response)result_str = result.xpath('//tbody[@id="cpdata"]/tr')for i i...原创 2018-12-24 19:48:12 · 2345 阅读 · 0 评论 -
认识爬虫(1)
可以直接拿来运行# 防止中文中文出现http协议定义URL中的保留字符,编码成16进制的字符串形式response = requests.get('https://tieba.baidu.com/f?kw=%E6%B5%81%E6%B5%AA%E6%B1%89')with open('tieba.html','w+',encoding='utf-8') as f: f.write(r...原创 2018-12-19 11:30:43 · 168 阅读 · 0 评论