|
|
@ -41,30 +41,15 @@ from .utils import (
|
|
|
|
try_call,
|
|
|
|
try_call,
|
|
|
|
write_string,
|
|
|
|
write_string,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
from .utils._utils import _YDLLogger
|
|
|
|
|
|
|
|
|
|
|
|
CHROMIUM_BASED_BROWSERS = {'brave', 'chrome', 'chromium', 'edge', 'opera', 'vivaldi'}
|
|
|
|
CHROMIUM_BASED_BROWSERS = {'brave', 'chrome', 'chromium', 'edge', 'opera', 'vivaldi'}
|
|
|
|
SUPPORTED_BROWSERS = CHROMIUM_BASED_BROWSERS | {'firefox', 'safari'}
|
|
|
|
SUPPORTED_BROWSERS = CHROMIUM_BASED_BROWSERS | {'firefox', 'safari'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YDLLogger:
|
|
|
|
class YDLLogger(_YDLLogger):
|
|
|
|
def __init__(self, ydl=None):
|
|
|
|
def warning(self, message, only_once=False): # compat
|
|
|
|
self._ydl = ydl
|
|
|
|
return super().warning(message, once=only_once)
|
|
|
|
|
|
|
|
|
|
|
|
def debug(self, message):
|
|
|
|
|
|
|
|
if self._ydl:
|
|
|
|
|
|
|
|
self._ydl.write_debug(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def info(self, message):
|
|
|
|
|
|
|
|
if self._ydl:
|
|
|
|
|
|
|
|
self._ydl.to_screen(f'[Cookies] {message}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def warning(self, message, only_once=False):
|
|
|
|
|
|
|
|
if self._ydl:
|
|
|
|
|
|
|
|
self._ydl.report_warning(message, only_once)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def error(self, message):
|
|
|
|
|
|
|
|
if self._ydl:
|
|
|
|
|
|
|
|
self._ydl.report_error(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProgressBar(MultilinePrinter):
|
|
|
|
class ProgressBar(MultilinePrinter):
|
|
|
|
_DELAY, _timer = 0.1, 0
|
|
|
|
_DELAY, _timer = 0.1, 0
|
|
|
|