import json import argparse from datetime import datetime def get_arguments(): all_args = argparse.ArgumentParser() all_args.add_argument("-i", "--Json", required=True, help="Choose the JSON file with the comment data") all_args.add_argument("-v", "--Video", required=False, help="OPTIONAL: Choose the video file") args = vars(all_args.parse_args()) return args def view_json_video(cli_args): with open(cli_args['Json']) as f: json_load = json.load(f) data = json_load['comments'] video = cli_args['Video'] return data, video def create_html(data_comments, data_video): # Beginning of the html file with open('index.html', 'w') as index: index.write(f"""
{i['author']} {i['time_text']}
{i['text']}
Date commented: {datetime.fromtimestamp(i['timestamp']).strftime('%d-%m-%Y')}
👍 {i['like_count']}