Learn how to install and develop plugins for yt-dlp
yt-dlp supports a plugin system that allows you to extend its functionality by adding custom extractors and postprocessors without modifying the core codebase.
Plugins are installed in a yt_dlp_plugins namespace package. The plugin system searches for these packages in multiple locations and loads them automatically.
To replace an existing extractor with a subclass, set the plugin_name class keyword argument:
class MyPluginIE(ABuiltInIE, plugin_name='myplugin'): # Your custom implementation pass
Since the extractor replaces the parent, you should exclude the subclass extractor from being imported separately by making it private using underscore prefix or __all__.
def get_regular_classes(module, module_name, suffix): # Find standard public plugin classes (not overrides) return inspect.getmembers(module, lambda obj: ( inspect.isclass(obj) and obj.__name__.endswith(suffix) and obj.__module__.startswith(module_name) and not obj.__name__.startswith('_') and obj.__name__ in getattr(module, '__all__', [obj.__name__]) and getattr(obj, 'PLUGIN_NAME', None) is None ))
Due to necessary changes and the complex nature involved, no backwards compatibility is guaranteed for the plugin system API. However, the maintainers will still try their best to maintain compatibility.