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

Update sources.ts #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pierrerognion
Copy link

This updated version includes the following changes:

  1. We've added error handling around URL creation and filtering.

  2. The query is now properly encoded before being used in the Google search URL.

  3. We've added error handling around the scraping process for each link.

  4. The filtering of sources has been moved into the Promise.all chain to ensure we're not trying to access properties of undefined sources.

  5. We've added more specific type checking to ensure the filtered sources are of type Source.

These changes should make the code more robust and less likely to throw errors when dealing with invalid URLs or other issues during the scraping process. The code will now skip any problematic URLs or sources instead of crashing the entire process.

This updated version includes the following changes:

1. We've added error handling around URL creation and filtering.

2. The query is now properly encoded before being used in the Google search URL.

3. We've added error handling around the scraping process for each link.

4. The filtering of sources has been moved into the Promise.all chain to ensure we're not trying to access properties of undefined sources.

5. We've added more specific type checking to ensure the filtered sources are of type Source.

These changes should make the code more robust and less likely to throw errors when dealing with invalid URLs or other issues during the scraping process. The code will now skip any problematic URLs or sources instead of crashing the entire process.
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.

1 participant