Git Product home page Git Product logo

cutescrapy's Introduction

可爱的小抓抓

Python爬虫框架Scrapy

###Scrapy框架

最近在做一个叫做TianTian的Django项目,数据是通过爬虫获取的,爬虫用的框架就是Scrapy
一开始我是想,用到了再查,毕竟主要是想做东西,爬虫框架当作工具用到的时候再翻一翻就行。然而,在操作的过程中发现不经过系统的学习,效率实在低了太多。
所谓工欲善其事必先利其器,在浪费了大量的时间在研究Scrapy零碎模块的用法上之后,决定还是从文档看起,从示例看起,然后再应用到自己的项目上.
爬虫的办法有很多,除了框架以外,我们还可以利用一些优秀的工具,比如BeautifulSoup和requests结合,但是成熟的框架必定有值得我们学习的地方,熟悉一下是很有必要的。^_^
####资源传送门:Scrapy1.0文档

###03.28更新

今天效率比较高,代码部分基本已经更完了. 资源传送门:Xpath教程

###03.29更新

今天更新了CrawlSpider这个类的示例 这个类主要有以下特点:

  • 有一个rule元组 可以满足我们在一个页面内抓取我们想要的链接
  • rule元组的执行顺序是从上倒下依次执行
  • Rule对象可以为指定格式的url定义回调函数和一些其它的规则
  • Rule参数里面如果设置了follow 意味着在捕获到的页面里面也要执行一遍rule元组里面定义的所有抓取规则
  • 像这个例子里面 我们设置page的follow为True 也就是持续跟进
  • 实践证明跟进的时候捕获的url不会和前面已经捕获过的重复

cutescrapy's People

Contributors

mieruko0713 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.