crawler

Version, currently 0.2.03 versions

github.com/maiha/crawler

web crawler

1 stars
0 dependents
License: MIT

Nothing has been indexed for 0.2.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  crawler:
    github: maiha/crawler
    version: ~> 0.2.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.2.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

crawler Build Status

Highly customizable web crawler

  • fast : Native code with libcurl
  • simple : Just edit config
  • flexible : Extract data by CSS and Regex
  • safe : Detect infinite loop
  • tracable : All HTTP transfered data are stored

Installation

Static Binary is ready for x86_64 linux
  • https://github.com/maiha/crawler/releases

Usage

  1. edit config
  2. receive html
  3. extract data
1. edit config

For the first time, config generate may help you.

$ crawler config generate
$ vi .crawlrc
[extract.json]
title = "css:div.r h3"
name  = ["css:p.name", "strip:"]

[crawl]
url      = "https://www.google.com/search?q=crystal"
next     = "css:a.pn"
html     = "css:div.rc"
page_max = 2

This means

  • Visits initial url config:crawl.url
  • Extracts html part config:crawl.html and stores in local
  • Follows next url config:crawl.next if page limit doesn't exceed config:crawl.page_max
2. receive html
$ crawler recv html
3. extract data
$ crawler extract json
$ crawler pb list json -f val
{"title":"Crystal"}
...

Development

for dynamic binary
$ make dynamic
for static binary

needs libcurl.a.

$ make static

Contributing

  1. Fork it (https://github.com/maiha/crawler/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • maiha - creator and maintainer