diff --git a/chat_downloader/chat_downloader.py b/chat_downloader/chat_downloader.py index 0ce16d3..db8f1e4 100644 --- a/chat_downloader/chat_downloader.py +++ b/chat_downloader/chat_downloader.py @@ -95,6 +95,7 @@ def get_chat(self, url=None, # Output output=None, + output_format=None, overwrite=True, sort_keys=True, indent=4, @@ -149,6 +150,8 @@ def get_chat(self, url=None, :param output: Path of the output file, defaults to None (print to standard output) :type output: str, optional + :param output_format: The output file format, like 'jsonl', 'txt', etc. + :type output_format: str, optional :param overwrite: If True, overwrite output file. Otherwise, append to the end of the file. Defaults to True. In both cases, the file (and directories) is created if it does not exist. @@ -266,6 +269,7 @@ def log_on_inactivity_timeout(): indent=params['indent'], sort_keys=params['sort_keys'], overwrite=params['overwrite'], + format=params['output_format'], lazy_initialise=True )) diff --git a/chat_downloader/cli.py b/chat_downloader/cli.py index 3fa035b..fc54617 100644 --- a/chat_downloader/cli.py +++ b/chat_downloader/cli.py @@ -139,6 +139,7 @@ def add_init_param(group, *keys, **kwargs): output_group = parser.add_argument_group('Output Arguments') add_chat_param(output_group, '--output', '-o') + add_chat_param(output_group, '--output_format', '-of') add_chat_param(output_group, '--overwrite', type=str2bool, nargs='?', const=True) add_chat_param(output_group, '--sort_keys',