Repository navigation
feat: add respect_robots_txt_file option - #1162
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new boolean flag, respect_robots_txt_file, to automatically skip crawling disallowed URLs based on a site's robots.txt rules. Key changes include the addition of tests for robots.txt handling across multiple crawler implementations, integration of robots.txt checking in the crawling pipeline, and the implementation of a RobotsTxtFile utility.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| "eval-type-backport>=0.2.0", | ||
| "httpx[brotli,http2,zstd]>=0.27.0", | ||
| "more-itertools>=10.2.0", | ||
| "protego>=0.4.0", |
There was a problem hiding this comment.
It's fun to see another scrapy project here, but I guess that it guarantees some stability, so... all good.
There was a problem hiding this comment.
Yes, I was planning to use RobotFileParser, but it doesn't support Google's specification. 😞
| self._robots = robots | ||
| self._original_url = URL(url).origin() | ||
|
|
||
| @staticmethod |
There was a problem hiding this comment.
I'd prefer using @classmethod and the Self return type annotation
Co-authored-by: Jan Buchar <Teyras@gmail.com>
vdusek
left a comment
There was a problem hiding this comment.
Nice! I have a few details... And also, could you please write a new guide/example regarding this feature?
Co-authored-by: Vlada Dusek <v.dusek96@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for automatically skipping requests disallowed by robots.txt files. Key changes include:
- Introducing a new boolean option (respect_robots_txt_file) across multiple crawler implementations.
- Adding caching and locking in the BasicCrawler to optimize fetching of robots.txt files.
- Adding new tests and examples for verifying correct respect of robots.txt rules.
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
Files not reviewed (1)
- docs/examples/respect_robots_txt_file.mdx: Language not supported
48a93b1 to
41b803d
Compare
…cording to `robots.txt` rules (#1166) ### Description - This PR supplements #1162 by adding an `on_skipped_request` decorator to handle references skipped according to `robots.txt` rules ### Issues - Closes: #1160 - Related #1162 --------- Co-authored-by: Vlada Dusek <v.dusek96@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Apify Release Bot <noreply@apify.com>

Description
respect_robots_txt_file.Issues
respectRobotsTxtFilecrawler option #1144Testing
respect_robots_txt_filefunctioning in ‘EnqueueLinksFunction’ for crawlersRobotsTxtFile