Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix closespider_itemcount/timeout features #79

Merged
merged 6 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ historical archival.
middlewares: [
Crawly.Middlewares.DomainFilter,
Crawly.Middlewares.UniqueRequest,
Crawly.Middlewares.UserAgent
{Crawly.Middlewares.UserAgent, user_agents: ["Crawly Bot"]}
],
pipelines: [
{Crawly.Pipelines.Validate, fields: [:url, :title]},
{Crawly.Pipelines.DuplicatesFilter, item_id: :title},
Crawly.Pipelines.JSONEncoder,
{Crawly.Pipelines.WriteToFile, extension: "jl", folder: "/tmp"} # NEW IN 0.7.0
{Crawly.Pipelines.WriteToFile, extension: "jl", folder: "/tmp"}
],
port: 4001
```
Expand Down Expand Up @@ -108,7 +108,7 @@ You can read more here:

1. [x] Pluggable HTTP client
2. [x] Retries support
3. [ ] Cookies support
3. [x] Cookies support
4. [x] XPath support - can be actually done with meeseeks
5. [ ] Project generators (spiders)
6. [ ] UI for jobs management
Expand Down
2 changes: 1 addition & 1 deletion documentation/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Goals:
Crawly.Middlewares.DomainFilter,
{Crawly.Middlewares.RequestOptions, [timeout: 30_000]},
Crawly.Middlewares.UniqueRequest,
Crawly.Middlewares.UserAgent
{Crawly.Middlewares.UserAgent, user_agents: ["Crawly Bot"]}
],
pipelines: [
{Crawly.Pipelines.Validate, fields: [:title, :url]},
Expand Down
4 changes: 2 additions & 2 deletions lib/crawly/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defmodule Crawly.Manager do

maybe_stop_spider_by_itemcount_limit(
state.name,
items_count,
delta,
Copy link
Collaborator

Choose a reason for hiding this comment

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

incorrect, items_count should be passed, as we are comparing items scraped, not scrape speed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, fixed

itemcount_limit
)

Expand All @@ -111,7 +111,7 @@ defmodule Crawly.Manager do

maybe_stop_spider_by_timeout(
state.name,
items_count,
delta,
closespider_timeout_limit
)

Expand Down