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

solution #358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

VolodymyrSemchysyn
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the code to scrape quotes from the website! 🎉 Your solution meets the task requirements and successfully handles pagination to gather all quotes. The code is well-structured and writes the data into a CSV file as expected.

There are a few minor improvements you could consider for future projects:

  1. Function Naming: Renaming get_all_quote to get_all_quotes would make the function name more intuitive.
  2. Error Handling: Adding checks to ensure elements like .author, .text, and .tags are present before accessing them would make your code more robust and prevent potential errors.

These are minor issues and don't affect the core functionality, so I'm happy to approve your work. Keep up the excellent work and happy coding! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

)


def get_all_quote() -> [Quote]:

Choose a reason for hiding this comment

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

The function name get_all_quote should be pluralized to get_all_quotes to accurately reflect that it returns a list of quotes.

Comment on lines +20 to +24
tags = quote_soup.select_one(".tags").text.split("\n")
cleaned_list_tags = [
tag.strip()
for tag in tags
if tag.strip() and tag.strip() != "Tags:"

Choose a reason for hiding this comment

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

The parse_single_quote function assumes that the .tags element and its text are always present. Consider adding error handling to manage cases where these elements might be missing.

if tag.strip() and tag.strip() != "Tags:"
]
return Quote(
text=quote_soup.select_one(".text").text,

Choose a reason for hiding this comment

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

Similarly, ensure that the .text element is present before accessing its text to avoid potential errors.

]
return Quote(
text=quote_soup.select_one(".text").text,
author=quote_soup.select_one(".author").text,

Choose a reason for hiding this comment

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

Ensure that the .author element is present before accessing its text to avoid potential errors.

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.

2 participants