-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add support for images with only srcset and no src #62
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62 +/- ##
==========================================
+ Coverage 37.79% 46.49% +8.70%
==========================================
Files 10 12 +2
Lines 688 727 +39
Branches 84 94 +10
==========================================
+ Hits 260 338 +78
+ Misses 426 376 -50
- Partials 2 13 +11 ☔ View full report in Codecov by Sentry. |
Why still draft? |
Because I realized while reviewing this PR on my own before submitting for review that it was a good opportunity to add some missing tests. Now done, you can review |
new_descriptor = new_descriptor.strip() | ||
if current_best_descriptor[-1:] != new_descriptor[-1:]: | ||
return False | ||
return int(new_descriptor[:-1]) > int(current_best_descriptor[:-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can an invalid descriptor be sent here? Like one that would fail to convert to int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it can happen, and then it will fail the scraper. This is intended for now, because it should not happen, so I prefer to fail the scraper, know about it, diagnose and decide what to do based on a real use-case (potentially just a parsing issue that needs to be handled) rather than taking bad decisions, having bad images and never noticing it. Thank you for the remark anyway.
Fix #59
Changes: