git clone https://github.com/our_new_public_git/tg_json_parser.git #TODO change it to the real git
cd tg_api_parser from tg_json_parser import TgJsonParser
# Initialize the parser
parser = TgJsonParser()
# Load JSON export file (replace with your file path)
chat_path = 'data/raw/Sample_ChatExport/result.json'
parser.load_json(chat_path) # Extract only content messages
parser.extract_messages()
# Access the structured data
print(f"Chat name: {parser.name}") print(f"Raw message: {parser.messages[0]}")
print(f"Content message: {parser.content_messages[0]}")
if hasattr(parser, 'member_actions'):
print(f"Service message: {len(parser.member_actions)}") import pandas as pd
df_messages = pd.DataFrame(tg_parcer.content_messages)
df_messages # Save to CSV files in specified directory
parcer.save_chat(output_path='data/processed/Sample_Chat', save_actions=True) from tg_json_parser import TgJsonParser
# Initialize and process
parser = TgJsonParser()
parser.load_json('path/to/result.json')
parser.extract_messages(save_actions=True)
parser.save_chat('./exported_data')
print(f"Exported {len(parser.content_messages)} messages from {parser.name}") python tg_json_parser.py input.json output_directory [--save_actions] # Basic export
python tg_json_parser.py data/raw/Sample_ChatExport/result.json data/processed/Sample_Chat
Subscribe to our newsletter!
You will receive our monthly newsletter with the most relevant Russia-related research news