Giter VIP home page Giter VIP logo

dingpa's Introduction

Dingpa (钉耙)

python web crawler with rich config file

Unit Test

Before install, you may want to run unittest. You can do it by

python unittest/unittest_all.py

Install

python setup.py install

Run

dingpa_crawl.py [config_file_name] [db_prefix] [shard] [total]

e.g.

dingpa_crawl.py test.conf test.db 1 10

The example command will use test.conf as config file, and save data in test.db.10.1. Here the shard/total is for sharding. And example command will only crawl urls whose hash mod 10 equals 1.

Config File Format

Following is a sample config

[edu]

url = http://zsb.bupt.edu.cn/
url = http://www.pku.edu.cn/

update = http://[a-z0-9]+.[a-z0-9]+.edu.cn/.*/
update = http://[a-z0-9]+.[a-z0-9]+.edu.cn/.*htm
update = http://[a-z0-9]+.[a-z0-9]+.edu.cn/.*html

[gov]

url = http://www.gov.cn
update = http://www.gov.cn/[a-z0-9]+/

Here, edu, gov is a group name of pages. url define seed urls. update define rules which use regex to filter pages you want to crawl.

Storage

dingpa use an embedded db CodernityDB to save downloaded data. We use embedded db instead of file system beacuse using filesystem will generate many small files which is hard to manage.

CodernityDB is a very fast no-sql embedded db for python.

dingpa's People

Contributors

xlvector avatar

Watchers

 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.