import json

file_path = 'd:\\NEW\\kingjoki\\play.ninjasage.har'

try:
    with open(file_path, 'r', encoding='utf-8') as f:
        data = json.load(f)

    entries = data.get('log', {}).get('entries', [])
    if entries:
        first_entry = entries[0]
        resp_content = first_entry.get('response', {}).get('content', {})
        
        print("Keys in response content:", resp_content.keys())
        if 'encoding' in resp_content:
            print(f"Encoding: {resp_content['encoding']}")
        
        text_preview = resp_content.get('text', '')
        print(f"Text length: {len(text_preview)}")
        print(f"Text preview (first 100 chars): {text_preview[:100]}")
        
        # Check request postData as well
        req_postData = first_entry.get('request', {}).get('postData', {})
        print("\nKeys in request postData:", req_postData.keys())
        if 'encoding' in req_postData: # Charles sometimes puts encoding here too? Standard HAR puts mimeType, text, params
            print(f"Encoding (Request): {req_postData.get('encoding')}") # Non-standard but possible
        
        req_text = req_postData.get('text', '')
        print(f"Request Text length: {len(req_text)}")
        print(f"Request Text preview: {req_text[:100]}")

except Exception as e:
    print(f"Error: {e}")
