diff options
author | B. Stack <bgstack15@gmail.com> | 2021-04-05 08:22:35 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-04-05 08:22:35 -0400 |
commit | cbf4a850ca6f4f888774c5a79490a92fe8db0870 (patch) | |
tree | e3ded7cc1a148c2b7d18972f91bd6383b9f09aa8 | |
parent | more precise logging (diff) | |
download | save-webfonts-cbf4a850ca6f4f888774c5a79490a92fe8db0870.tar.gz save-webfonts-cbf4a850ca6f4f888774c5a79490a92fe8db0870.tar.bz2 save-webfonts-cbf4a850ca6f4f888774c5a79490a92fe8db0870.zip |
use harfile entry 0 for domain name
-rwxr-xr-x | savewebfonts_lib.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/savewebfonts_lib.py b/savewebfonts_lib.py index ab8d7c1..cb29ec7 100755 --- a/savewebfonts_lib.py +++ b/savewebfonts_lib.py @@ -290,7 +290,11 @@ def whitelist_harfile(harfile, fontdir, config = config_default): all_fonts = get_all_fonts_from_csslist(all_css, config) # Prepare destination dir - destdir = os.path.join(fontdir,"harfiles") + with open(harfile,'r') as o: + har_contents = o.read() + a = json.loads(har_contents) + domain = urlparse(a['log']['entries'][0]['request']['url']).netloc # get first entry's domain name + destdir = os.path.join(fontdir,"harfile-"+domain) # Save all fonts to that dir return save_all_fonts(all_fonts, destdir, config) |