Export utilities APIs to public and minor fixes #32
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 several enhancements, including the addition of new utility APIs, improvements to the YouTube URL regex, and minor fixes to existing modules. The changes aim to provide developers with more robust tools for working with YouTube URLs and handling errors effectively.
Key Changes
New Features
extractVideoId
: Extracts the video ID from a YouTube URL.validateUrl
: Validates whether a given URL is a valid YouTube URL.validateId
: Validates whether a given string is a valid YouTube video ID.error
module, providing more robust error handling capabilities. This includes:IDExtractorError
UnknownOptionError
YTURLUtils
class (aliased fromURLUtils
), which offers static methods for developers working with YouTube URLs.Refactors
Fixes
exports
statement in theerror
module to ensure all custom error classes are exported properly.Previously, when attempt to import the
error
module, the returned object is an empty object ({}
).Test Environments
IDExtractorError
class, replacing the previous string representation of the class name with the actual class.Summary
These updates enhance the flexibility and reliability of the
ytmp3
module by introducing new utility APIs and refining existing components. The improved YouTube URL validation regex and corrected export statements ensure a smoother experience for developers integrating YouTube functionalities into their projects. The added utilities and error handling enhancements will help prevent common issues and streamline the development process.