Skip to content

Instantly share code, notes, and snippets.

@timo-berg
Created December 6, 2020 21:53
Show Gist options
  • Save timo-berg/7aa2297911147e53bd0c4e6804a9ecd7 to your computer and use it in GitHub Desktop.
Save timo-berg/7aa2297911147e53bd0c4e6804a9ecd7 to your computer and use it in GitHub Desktop.
import json
import requests
from haralyzer import HarParser, HarPage
with open('pictures.har', 'r') as f:
har_page = HarPage('page_1', har_data=json.loads(f.read()))
for i, entry in enumerate(har_page.entries):
request = entry['request']
url = request['url']
response = requests.get(url)
pic_string = "pciture_{}.png".format(i)
file = open(pic_string, "wb")
file.write(response.content)
file.close()
print("Picture Nr {} saved!".format(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment