Skip to content

xuanbo/colly_plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CollyPlus

A functional spider based on colly.

Features

  • Functional
  • Redis Queue

Example

package main

import (
	"log"
	"time"

	spider "github.com/xuanbo/colly_plus"
)

func main() {
	spider.Create().
		Parallelism(5).
		Sleep(300 * time.Millisecond).
		OnResponse(func(r *spider.ResponseWrapper, q *spider.QueueWrapper) {
			resp := r.Response
			log.Printf("Visited: %s, body: %s.\n", resp.Request.URL, resp.Body)
		}).
		OnError(func(r *spider.ResponseWrapper, err error, q *spider.QueueWrapper) {
			log.Printf("Visit: %s, went wrong: %s\n", r.Response.Request.URL, err)
		}).
		StartUrl("https://github.com/xuanbo/colly_plus").
		Run()
}

See examples folder for more detailed examples.

Installation

go get github.com/xuanbo/colly_plus

About

A functional spider based on colly

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages