feat: Implement ParselCrawler that adds support for Parsel#348
Merged
janbuchar merged 8 commits intoapify:masterfrom Aug 7, 2024
Merged
feat: Implement ParselCrawler that adds support for Parsel#348janbuchar merged 8 commits intoapify:masterfrom
janbuchar merged 8 commits intoapify:masterfrom
Conversation
janbuchar
reviewed
Jul 23, 2024
Comment on lines
+215
to
+222
| # Simulate ImportError for parsel | ||
| with mock.patch.dict('sys.modules', {'parsel': None}): | ||
| # Invalidate ParselCrawler import | ||
| sys.modules.pop('crawlee.parsel_crawler', None) | ||
| sys.modules.pop('crawlee.parsel_crawler.parsel_crawler', None) | ||
|
|
||
| with pytest.raises(ImportError) as import_error: | ||
| from crawlee.parsel_crawler import ParselCrawler |
2d92749 to
bcaf1d2
Compare
janbuchar
reviewed
Jul 26, 2024
Collaborator
janbuchar
left a comment
There was a problem hiding this comment.
Nice job, thank you! Just two comments to think about.
src/crawlee/parsel_crawler/types.py
Outdated
| class ParselCrawlingContext(HttpCrawlingResult, BasicCrawlingContext): | ||
| """Crawling context used by ParselCrawler.""" | ||
|
|
||
| parsel: Selector |
Collaborator
There was a problem hiding this comment.
From a quick glance at the docs, I believe that the idiomatic name for this would be selector. What do you think?
| ) | ||
|
|
||
| # Regex for identifying email addresses on a webpage. | ||
| EMAIL_REGEX = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' |
Collaborator
There was a problem hiding this comment.
I'm conflicted about parsing e-mail addresses with regexp like this. The presented use case is cool, but there is almost certainly some mistake here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Issues
Testing
Checklist
CHANGELOG.md