Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (q *Queue) AddURL(URL string) error {
r := &colly.Request{
URL: u2,
Method: "GET",
Depth: 1,
}
d, err := r.Marshal()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (r *Request) Retry() error {

// Do submits the request
func (r *Request) Do() error {
return r.collector.scrape(r.URL.String(), r.Method, r.Depth, r.Body, r.Ctx, *r.Headers, !r.collector.AllowURLRevisit)
return r.collector.scrape(r.URL.String(), r.Method, r.Depth+1, r.Body, r.Ctx, *r.Headers, !r.collector.AllowURLRevisit)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change. Could you please clarify? The test you added doesn't catch it if I revert this change.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd, the TestCollectorDepth test should catch that, it's so that the depth increases on each request, so that you can use MaxDepth in Queue-based crawlers. I'll take a look at it.

}

// Marshal serializes the Request
Expand Down