Last active
March 16, 2024 03:24
-
-
Save achmel/e189ad4b8b4e28c235796994fe2cb68e to your computer and use it in GitHub Desktop.
Tiny parser to get websocket messages from Google Chrome Developer Tools > Network > Export HAR...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/usr/bin/env python3 | |
# encoding: utf-8 | |
import json | |
file_name = 'websocket.har' | |
f = open(file_name) | |
j = json.load(f) | |
entries = j['log']['entries'] | |
for e in entries: | |
if e['_resourceType'] == 'websocket' and '_webSocketMessages' in e.keys(): | |
messages = e['_webSocketMessages'] | |
for m in messages: | |
if len(m['data']) > 1: | |
print(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment