-# Allow direct execution
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-
-import youtube_dl.FileDownloader
-import youtube_dl.InfoExtractors
-from youtube_dl.utils import *
-
-DEF_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tests.json')
-PARAMETERS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parameters.json")
-
-# General configuration (from __init__, not very elegant...)
-jar = compat_cookiejar.CookieJar()
-cookie_processor = compat_urllib_request.HTTPCookieProcessor(jar)
-proxy_handler = compat_urllib_request.ProxyHandler()
-opener = compat_urllib_request.build_opener(proxy_handler, cookie_processor, YoutubeDLHandler())
-compat_urllib_request.install_opener(opener)
-
-def _try_rm(filename):
- """ Remove a file if it exists """
- try:
- os.remove(filename)
- except OSError as ose:
- if ose.errno != errno.ENOENT:
- raise
-
-class FileDownloader(youtube_dl.FileDownloader):
+import youtube_dl.YoutubeDL
+from youtube_dl.utils import (
+ compat_http_client,
+ compat_str,
+ compat_urllib_error,
+ compat_HTTPError,
+ DownloadError,
+ ExtractorError,
+ UnavailableVideoError,
+)
+from youtube_dl.extractor import get_info_extractor
+
+RETRIES = 3
+
+class YoutubeDL(youtube_dl.YoutubeDL):