Code Monkey home page Code Monkey logo

raindrop-spider's Introduction

raindrop-spider

A simple distribute spider based on scrapy framework.

Reference

scrapy
scrapyd
scrapyd-client
mongodb

Install

$ apt-get install curl libffi-dev libxml2-dev libxslt1-dev -y
$ apt-get install mongodb -y

$ cd raindrop-spider
$ virtualenv env
$ source env/local/bin/activate
$ pip install -r requirement.txt

Fast start

config scrapyd and then start a scrapyd server

$ cd raindrop-spider
$ mkdir /etc/scrapyd
$ cp etc/scrapyd.conf /etc/scrapyd
$ source env/local/bin/activate
$ scrapyd

deploy scrapy spider

open a new ssh tab, excute commands to deploy scrapy spider on scrapyd server

$ cd raindrop-spider
$ source env/local/bin/activate
$ cd spider
$ scrapyd-deploy

test spider

params: uid is the sns account id that you wanna spider

$ curl http://localhost:6800/schedule.json -d project=spider -d spider=gh_user -d uid=account-id 

check the result

1.check log
you would see the logs below if the spider task succeed

2015-10-22 15:44:44+0000 [-] Process started:  project='spider' spider='gh_user' 
job='cf1e9a2678d311e5bdd5080027880ca6' pid=4199 
log='logs/spider/gh_user/cf1e9a2678d311e5bdd5080027880ca6.log'

2015-10-22 15:44:47+0000 [-] Process finished:  project='spider' spider='gh_user' 
job='cf1e9a2678d311e5bdd5080027880ca6' pid=4199 
log='logs/spider/gh_user/cf1e9a2678d311e5bdd5080027880ca6.log' 

2.check mongodb
you could check mongodb after seconds

$ mongo
> use raindrop

you can check the collections by command like this

> show collections

you can check data in collections by commad like this

> db.gh_user.find({})

Development

develop your own spider

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.