aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils/_utils.py
diff options
context:
space:
mode:
authorNicolai Dagestad <nicolai.github@dagestad.fr>2023-06-21 05:07:42 +0200
committerGitHub <noreply@github.com>2023-06-21 08:37:42 +0530
commitdb3ad8a67661d7b234a6954d9c6a4a9b1749f5eb (patch)
treef3ad8c554513bd06901ae78b2642c9a1ff407d81 /yt_dlp/utils/_utils.py
parentaf7585c824a1e405bd8afa46d87b4be322edc93c (diff)
downloadhypervideo-pre-db3ad8a67661d7b234a6954d9c6a4a9b1749f5eb.tar.lz
hypervideo-pre-db3ad8a67661d7b234a6954d9c6a4a9b1749f5eb.tar.xz
hypervideo-pre-db3ad8a67661d7b234a6954d9c6a4a9b1749f5eb.zip
Add option `--netrc-cmd` (#6682)
Authored by: NDagestad, pukkandan Closes #1706
Diffstat (limited to 'yt_dlp/utils/_utils.py')
-rw-r--r--yt_dlp/utils/_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py
index d10d621d5..28c2785cb 100644
--- a/yt_dlp/utils/_utils.py
+++ b/yt_dlp/utils/_utils.py
@@ -25,6 +25,7 @@ import json
import locale
import math
import mimetypes
+import netrc
import operator
import os
import platform
@@ -864,6 +865,13 @@ def escapeHTML(text):
)
+class netrc_from_content(netrc.netrc):
+ def __init__(self, content):
+ self.hosts, self.macros = {}, {}
+ with io.StringIO(content) as stream:
+ self._parse('-', stream, False)
+
+
def process_communicate_or_kill(p, *args, **kwargs):
deprecation_warning(f'"{__name__}.process_communicate_or_kill" is deprecated and may be removed '
f'in a future version. Use "{__name__}.Popen.communicate_or_kill" instead')