The BaseExtractor class is the foundation for creating custom music extractors in discord-player. When implementing a new extractor, you will typically extend this class and override key methods to handle queries, stream tracks, and manage the extractor lifecycle.
Core Lifecycle Methods
activate(): Executed when the extractor is activated.deactivate(): Executed when the extractor is deactivated.reconfigure(options): Updates the extractor with new initialization options.
Key Functionality Methods
handle(query, context): The primary entry point for processing a search query. It should return an ExtractorInfo object.stream(info): Responsible for returning an ExtractorStreamable for a given track.validate(query, type?): Checks if a given query is valid for this extractor.getRelatedTracks(track, history): Retrieves related tracks based on a source track and history.
// Example of how you might instantiate or extend the base class
new BaseExtractor(context, options);