aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-06-21 12:12:15 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-06-21 12:13:27 +0530
commitd7cd97e8d8d42b500fea9abb2aa4ac9b0f98b2ad (patch)
tree05cd902de7e13f1798e7e93afa49db1f072df339
parentd1b21561497b6bbb8ff1202e63f48eb41bd315af (diff)
downloadhypervideo-pre-d7cd97e8d8d42b500fea9abb2aa4ac9b0f98b2ad.tar.lz
hypervideo-pre-d7cd97e8d8d42b500fea9abb2aa4ac9b0f98b2ad.tar.xz
hypervideo-pre-d7cd97e8d8d42b500fea9abb2aa4ac9b0f98b2ad.zip
Fix bug in db3ad8a67661d7b234a6954d9c6a4a9b1749f5eb
Closes #7367
-rw-r--r--README.md2
-rw-r--r--yt_dlp/extractor/common.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2f1fd9a0d..a2bc33fbd 100644
--- a/README.md
+++ b/README.md
@@ -1221,7 +1221,7 @@ To activate authentication with the `.netrc` file you should pass `--netrc` to y
The default location of the .netrc file is `~` (see below).
-As an alternative to using the `.netrc` file, which has the disadvantage of keeping your passwords in a plain text file, you can configure a custom shell command to provide the credentials for an extractor. This is done by providing the `--netrc-cmd` parameter, it shall output the credentials in the netrc format and return `0` on success, other values will be treated as an error. `{}` in the command will be replaced by the name of the extractor to make it possible to select the credentials for the right extractor (To use literal braces, double them like `{{}}`).
+As an alternative to using the `.netrc` file, which has the disadvantage of keeping your passwords in a plain text file, you can configure a custom shell command to provide the credentials for an extractor. This is done by providing the `--netrc-cmd` parameter, it shall output the credentials in the netrc format and return `0` on success, other values will be treated as an error. `{}` in the command will be replaced by the name of the extractor to make it possible to select the credentials for the right extractor.
E.g. To use an encrypted `.netrc` file stored as `.authinfo.gpg`
```
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 9662a7ee1..2ea36c63d 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -1297,8 +1297,9 @@ class InfoExtractor:
def _get_netrc_login_info(self, netrc_machine=None):
netrc_machine = netrc_machine or self._NETRC_MACHINE
- cmd = self.get_param('netrc_cmd', '').format(netrc_machine)
+ cmd = self.get_param('netrc_cmd')
if cmd:
+ cmd = cmd.replace('{}', netrc_machine)
self.to_screen(f'Executing command: {cmd}')
stdout, _, ret = Popen.run(cmd, text=True, shell=True, stdout=subprocess.PIPE)
if ret != 0: