aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2021-04-05 08:22:35 -0400
committerB. Stack <bgstack15@gmail.com>2021-04-05 08:22:35 -0400
commitcbf4a850ca6f4f888774c5a79490a92fe8db0870 (patch)
treee3ded7cc1a148c2b7d18972f91bd6383b9f09aa8
parentmore precise logging (diff)
downloadsave-webfonts-cbf4a850ca6f4f888774c5a79490a92fe8db0870.tar.gz
save-webfonts-cbf4a850ca6f4f888774c5a79490a92fe8db0870.tar.bz2
save-webfonts-cbf4a850ca6f4f888774c5a79490a92fe8db0870.zip
use harfile entry 0 for domain name
-rwxr-xr-xsavewebfonts_lib.py6
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)
bgstack15