aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-04-16 08:54:48 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-04-16 08:55:44 +0530
commit9874e82b5a61582169300bea561b3e8899ad1ef7 (patch)
treee8862c786da71d71f1704b9dc5bc466593619b11
parent84ffeb7d5e72e3829319ba7720a8480fc4c7503b (diff)
downloadhypervideo-pre-9874e82b5a61582169300bea561b3e8899ad1ef7.tar.lz
hypervideo-pre-9874e82b5a61582169300bea561b3e8899ad1ef7.tar.xz
hypervideo-pre-9874e82b5a61582169300bea561b3e8899ad1ef7.zip
Do not translate newlines in `--print-to-file`
Fixes https://github.com/yt-dlp/yt-dlp/issues/6808#issuecomment-1509361107
-rw-r--r--yt_dlp/YoutubeDL.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 7b6fef204..31f7645dc 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -2890,8 +2890,8 @@ class YoutubeDL:
tmpl = format_tmpl(tmpl)
self.to_screen(f'[info] Writing {tmpl!r} to: {filename}')
if self._ensure_dir_exists(filename):
- with open(filename, 'a', encoding='utf-8') as f:
- f.write(self.evaluate_outtmpl(tmpl, info_copy) + '\n')
+ with open(filename, 'a', encoding='utf-8', newline='') as f:
+ f.write(self.evaluate_outtmpl(tmpl, info_copy) + os.linesep)
def __forced_printings(self, info_dict, filename, incomplete):
def print_mandatory(field, actual_field=None):