Merged
Conversation
khoshov
reviewed
Jul 3, 2025
| logger = setup_logger(module_name=__name__, log_dir="logs/scrapers") | ||
|
|
||
|
|
||
| class AsyncBookFetcher(BaseScraper): |
Owner
There was a problem hiding this comment.
Кажется лучше вынести в отдельный модуль
khoshov
reviewed
Jul 3, 2025
| "cover": parser.extract_cover_image(), | ||
| } | ||
| logger.debug(f"parsed book data for: {book_data['book_title']}") | ||
| return book_data |
Owner
There was a problem hiding this comment.
Посмотреть весь пул реквест на соответствие принципам SOLID (на первом месте SRP, на втором DI, остальные по желанию)
khoshov
reviewed
Jul 17, 2025
| parser = BookParser(html) | ||
| book_data = { | ||
| "url": url, | ||
| "book_title": parser.extract_book_name().get("book_title", ""), |
Owner
There was a problem hiding this comment.
Вот тут для меня выглядит странно, почему не обработать внутри метода
khoshov
reviewed
Jul 17, 2025
|
|
||
|
|
||
| class BookParser: | ||
| def __init__(self, html: str, base_domain: str = "https://www.piter.com"): |
Owner
There was a problem hiding this comment.
https://www.piter.com я бы вынес куда-то в глобальную переменную
khoshov
reviewed
Jul 17, 2025
| if name_tag: | ||
| full_name = name_tag.get_text(strip=True) | ||
| parts = full_name.split() | ||
| if len(parts) == 1: |
khoshov
reviewed
Jul 17, 2025
| return book_data | ||
|
|
||
|
|
||
| class Command(BaseCommand): |
Owner
There was a problem hiding this comment.
Можно добавить docstrings и type hints
khoshov
approved these changes
Jul 17, 2025
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.
No description provided.