Refactor YouTube URL validator and introduce utility modules #29
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.
Overview
This pull request introduces significant improvements to the YouTube URL validation process by replacing the previous regex-based validation with a more robust and reliable method. Additionally, several utility modules were added and refactored to enhance the maintainability and functionality of the project.
Key Changes
Features
url-utils
module that provides a utility class with static methods for working with YouTube URLs.The module includes methods for URL validation and video ID extraction, aiming to offer a more accurate and strict validation process compared to using regular expressions alone.
log
is now aliased fromlogger
to improve code readability.error
module containing all custom error classes used within the project.Refactors
URLUtils.validateUrl
), ensuring more reliable URL handling.utils
module and updated the documentation accordingly to ensure a cleaner and more organized structure.IDExtractionError
andUnknownOptionError
classes to the newerror
module, centralizing error management.Testing
url-utils
module to ensure the reliability and accuracy of the new URL validation and extraction methods.Impact
This refactor is a crucial step in making the project more robust, reliable, and easier to maintain, especially concerning YouTube URL handling.