fix permissions, output html, and timeouts

This commit is contained in:
Nick Sweeting 2017-06-15 18:49:16 -05:00
parent a9d6a95c73
commit 2d8364a7c7
2 changed files with 5 additions and 4 deletions

View file

@ -160,6 +160,7 @@ def fetch_pdf(out_dir, link, overwrite=False):
chrome_args = '--headless --disable-gpu --print-to-pdf'.split(' ')
try:
run([CHROME_BINARY, *chrome_args, link['url']], stdout=DEVNULL, stderr=DEVNULL, cwd=out_dir, timeout=20) # output.pdf
run(['chmod', '755', 'output.pdf'], timeout=5)
except Exception as e:
print(' Exception: {} {}'.format(e.__class__.__name__, e))
else:
@ -172,6 +173,7 @@ def fetch_screenshot(out_dir, link, overwrite=False):
chrome_args = '--headless --disable-gpu --screenshot'.split(' ')
try:
run([CHROME_BINARY, *chrome_args, '--window-size={}'.format(RESOLUTION), link['url']], stdout=DEVNULL, stderr=DEVNULL, cwd=out_dir, timeout=20) # sreenshot.png
run(['chmod', '755', 'screenshot.png'], timeout=5)
except Exception as e:
print(' Exception: {} {}'.format(e.__class__.__name__, e))
else:
@ -384,7 +386,7 @@ def create_archive(export_file, service=None, resume=None):
dump_index(links, service)
run(['chmod', '-R', '755', service], timeout=10)
run(['chmod', '-R', '755', service], timeout=30)
print('[*] [{}] Created archive index with {} links.'.format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), len(links)))