]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/YoutubeDL.py
Do not translate newlines in `--print-to-file`
[yt-dlp.git] / yt_dlp / YoutubeDL.py
index 7b6fef2041d080f45acd34f21dbcec91bc2726d8..31f7645dca94ac2fd58a40aa021e1b266b02f5b0 100644 (file)
@@ -2890,8 +2890,8 @@ def format_tmpl(tmpl):
             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):