![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
陈小峰_iefreer
踏得网创始人,Stone和Myway 3D引擎作者。
展开
-
Scrapy:抓取html所有特定元素的两个方法
比如要获取所有class=test的div元素,1. 用Scrapy,示范代码: def parse(self, response): hxs = Selector(response) items = [] divs = hxs.xpath('//div[@class="test"]')2. 用lxml,示范代码:from lxml impo原创 2014-03-08 01:30:19 · 14768 阅读 · 4 评论 -
Scrapy递归索引
有时候定向索引任务需要结合列表页面和内容详细页面才可以得到完整信息。原创 2014-08-05 02:16:05 · 2849 阅读 · 0 评论 -
Python 检查数组元素是否存在 类PHP isset()
PHP中有isset方法来检查数组元素是否存在,在Python中无对应函数。原创 2014-10-11 00:06:34 · 13321 阅读 · 2 评论 -
Scrapy: 发送带Cookie的请求
Yield发送的请求,联系你的方法。原创 2014-06-08 21:17:44 · 36458 阅读 · 0 评论 -
Scrapy: 爬虫返回403错误
抓取数据时,通常调试信息是:原创 2014-06-26 02:15:35 · 33646 阅读 · 1 评论 -
Python: 数组条件过滤简洁实现方式
使用filter函数,实现一个过滤函数即可。原创 2014-06-23 20:20:27 · 11806 阅读 · 1 评论 -
Scrapy:Spider参数及其应用场景
Spiders可以接收参数,以改变其抓取行为。通常的应用场景是定义请求链接(start_urls)来限定抓取目标网站的某个栏目,当然参数还可以用来控制整个Spider的功能。Spider参数通过 crawl 命令的 -a 选项来传递,比如:scrapy crawl myspider -a category=electronicsSpiders通过构造函数获取参数:class MySpider(Sp翻译 2014-03-27 00:53:39 · 6424 阅读 · 0 评论 -
Scrapy:抓取返回数据格式为JSON的网站内容
http://stackoverflow.com/questions/18171835/scraping-a-json-response-with-scrapy原创 2014-03-09 02:18:06 · 26073 阅读 · 2 评论 -
CentOS6.2下面安装使用Scrapy遇到的一些错误
1. 无法连接python https服务器打开防火墙iptables 443端口,确认openssl已安装2. No package 'libffi' foundyum install libffi libffi-dev3. pip install lxml error:xslt-config: not foundyum install libxslt-devel libxml2-devel p原创 2014-03-02 02:04:31 · 12698 阅读 · 7 评论 -
Scrapy:一次性运行多个Spiders
http://stackoverflow.com/questions/10801093/run-multiple-scrapy-spiders-at-once-using-scrapyd原创 2014-03-07 10:39:12 · 20893 阅读 · 3 评论