func (this *ExampleExtender) Filter(ctx *gocrawl.URLContext, isVisited bool) bool { // fmt.Println("filter url: ", ctx.URL(), "state: ", ctx.State, "isVisited: ", isVisited, "ctx.IsRobotsURL(): ", ctx.IsRobotsURL()) if ctx.SourceURL() == nil { ctx.State = DEPTH return !isVisited } if ctx.State != nil { i, ok := ctx.State.(int) if ok && i > 0 { return !isVisited } } else { fmt.Println("ctx.state nil, ctx.sourceURL: ", ctx.SourceURL()) } return false }