Giter Site home page Giter Site logo

douban-crawler's Introduction

douban-crawler

利用Python的Scrapy框架爬取豆瓣电影信息,项目添加了user-agent和proxy代理两种方式来进行爬虫隐藏,并将获取的数据保存到MongoDB中。

请合法进行爬虫行为!

Quick Start

启动应用

pip install -r requirements.txt

然后运行__init__.py文件即可

应用截图

img.png

scrapy框架组成

img.png

各部分组成

  • Scrapy Engine:中心引擎,负责通讯,信号,传输数据等
  • Downloader:下载器,下载引擎发送的所有请求,并将其获取到的response交还给引擎
  • Scheduler:调度器,接受引擎发送过来的请求,并按照一定的方式进行整理排列入队,当引擎需要时交还给引擎
  • Spider:负责处理所有response,从中分析提取数据,获取Item字段需要的数据,并将需要跟进的新的URL提交给引擎,进一步爬取
  • Item Pipeline:负责处理Spider中获取到的Item,并进行进行后期处理(详细分析、过滤、存储等)
  • Downloader Middlewares:可以自定义扩展或封装下载功能的组件
  • Spider Middlewares:可以自定义扩展和操作Spider和Engine之间的URL请求的组件

数据流

数据流如图所示

MongoDB数据库安装

OSX安装MongoDB

brew tap mongodb/brew
brew install [email protected]
# @后为版本

MongoDB使用注意

MongoDB中的数据库不是实时创建的,需要在插入了文档后,才能够生效(show dbs才能查询到)

douban-crawler's People

Contributors

lbruyne avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.