From 52338d47deb47d8f0b8b48143b5147a86309cd81 Mon Sep 17 00:00:00 2001 From: X Date: Fri, 6 May 2022 10:25:10 +0200 Subject: [PATCH] Add total posts to the hashtag_frequencies console printing --- tiktok_downloader/file_methods.py | 2 +- tiktok_downloader/hashtag_frequencies.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tiktok_downloader/file_methods.py b/tiktok_downloader/file_methods.py index 43184fe..e9d4328 100644 --- a/tiktok_downloader/file_methods.py +++ b/tiktok_downloader/file_methods.py @@ -118,7 +118,7 @@ def log_writer(log_data: list): Writes the dictionary to the log file (logs/log.json). """ total = 0 - scraped_summary_dict: dict + scraped_summary_dict: dict = {} for hashtag, (data_type, count) in log_data: if hashtag in scraped_summary_dict: if data_type in scraped_summary_dict[hashtag]: diff --git a/tiktok_downloader/hashtag_frequencies.py b/tiktok_downloader/hashtag_frequencies.py index 5ad3f41..1650f73 100644 --- a/tiktok_downloader/hashtag_frequencies.py +++ b/tiktok_downloader/hashtag_frequencies.py @@ -92,6 +92,7 @@ def print_occurrences(occs): ratio = value / total_posts print("{:<8} {:<15} {:<15} {:<15}".format(row_number, key, value, ratio)) row_number += 1 + print(f"Total posts: {total_posts}") def save_plot(img_folder):