Created
July 20, 2020 20:23
-
-
Save brunogfranca/8106f7a7927747bb601f47acc9cb3dfd to your computer and use it in GitHub Desktop.
This file contains 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
import json | |
from urllib.parse import urlparse | |
def parse_har(filename): | |
with open(filename) as h: | |
data = json.loads(h.read()) | |
urls = list(set([i['request']['url'] for i in data['log']['entries']])) | |
domains = list(set([urlparse(i).netloc for i in urls])) | |
with open(f'{filename}.urls.csv', 'w+') as h: | |
for url in urls: | |
h.write(f'{url}\n') | |
with open(f'{filename}.domains.csv', 'w+') as h: | |
for domain in domains: | |
h.write(f'{domain}\n') | |
parse_har('stoodi-video.har') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment