From 526eb7d5e4d9b5254bf17643ac50a27417cffd78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Koz=C5=82owski?= Date: Sat, 7 Jan 2023 11:42:54 +0100 Subject: [PATCH] fix save --- crawler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crawler.py b/crawler.py index f24eaeb..dcc639a 100644 --- a/crawler.py +++ b/crawler.py @@ -38,6 +38,7 @@ def main(args): with tqdm(total=max_len) as pbar: if args.start_page_number: pbar.update(data_number) + pbar.refresh() while data_number < max_len: pbar.set_description(f"Page number: {page_number}") @@ -64,6 +65,8 @@ def main(args): except Exception as e: print(e) save_data(f"./{args.output_file_name}-{args.type}.tsv", result_list) + except KeyboardInterrupt: + save_data(f"./{args.output_file_name}-{args.type}.tsv", result_list) save_data(f"./{args.output_file_name}-{args.type}.tsv", result_list)