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

Respect robots txt #45

Merged
merged 8 commits into from
Jun 19, 2024
Merged

Conversation

Mews
Copy link
Collaborator

@Mews Mews commented Jun 19, 2024

Closes #42

Changes

  • Added a new networking.robots_txt submodule;
  • Separated some of the crawler logic to separate functions to avoid pylint's too-many-branches;
  • Spider.crawl now checks whether scraping a website is allowed and also respects specified crawl delay;
  • Added new tests for the robots_txt submodule and for the respect_robots_txt option of Spider
  • Increased max-attributes in .pylintrc

tests/networking/test_robots_txt.py Outdated Show resolved Hide resolved
)

mock_urlopen.side_effect = lambda url: (
BytesIO(b"User-agent: *\nDisallow: /") if url == "http://notcrawlable.com/robots.txt" else
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we make this into two separate tests and avoid this branch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean?

@indrajithi indrajithi merged commit 6f5ea34 into DataCrawl-AI:master Jun 19, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect robots.txt when crawling when set as True
2 participants