]> jfr.im git - yt-dlp.git/blob - devscripts/lazy_load_template.py
d06655d106513394e70efdd1ef2c7af8d4faa9da
[yt-dlp.git] / devscripts / lazy_load_template.py
1 #!/usr/bin/env python3
2 # coding: utf-8
3 from __future__ import unicode_literals
4
5 import re
6
7
8 class LazyLoadExtractor(object):
9 _module = None
10
11 @classmethod
12 def ie_key(cls):
13 return cls.__name__[:-2]
14
15 def __new__(cls, *args, **kwargs):
16 mod = __import__(cls._module, fromlist=(cls.__name__,))
17 real_cls = getattr(mod, cls.__name__)
18 instance = real_cls.__new__(real_cls)
19 instance.__init__(*args, **kwargs)
20 return instance