diff --git a/archive.py b/archive.py index 83363307..2a54a85c 100755 --- a/archive.py +++ b/archive.py @@ -158,10 +158,12 @@ def fetch_wget(out_dir, link, overwrite=False): print(' - Downloading Full Site') CMD = [ *'wget --no-clobber --page-requisites --adjust-extension --convert-links --no-parent'.split(' '), - link['url'], ] try: - run(CMD, stdout=DEVNULL, stderr=DEVNULL, cwd=out_dir, timeout=20) # dom.html + output = run(CMD, stdout=DEVNULL, stderr=PIPE, cwd=out_dir, timeout=20) # dom.html + if output.returncode: + print(output.stderr.read()) + raise Exception('Failed to wget download') except Exception as e: print(' Exception: {} {}'.format(e.__class__.__name__, e)) else: @@ -174,8 +176,9 @@ def fetch_pdf(out_dir, link, overwrite=False): print(' - Printing PDF') 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 + result = run([CHROME_BINARY, *chrome_args, link['url']], stdout=DEVNULL, stderr=PIPE, cwd=out_dir, timeout=20) # output.pdf if run(['chmod', ARCHIVE_PERMISSIONS, 'output.pdf'], stdout=DEVNULL, stderr=DEVNULL, timeout=5).returncode: + print(result.stderr.read()) raise Exception('Failed to print PDF') except Exception as e: print(' Exception: {} {}'.format(e.__class__.__name__, e)) @@ -189,8 +192,9 @@ def fetch_screenshot(out_dir, link, overwrite=False): print(' - Snapping Screenshot') 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 + result = run([CHROME_BINARY, *chrome_args, '--window-size={}'.format(RESOLUTION), link['url']], stdout=DEVNULL, stderr=DEVNULL, cwd=out_dir, timeout=20) # sreenshot.png if run(['chmod', ARCHIVE_PERMISSIONS, 'screenshot.png'], stdout=DEVNULL, stderr=DEVNULL, timeout=5).returncode: + print(result.stderr.read()) raise Exception('Failed to take screenshot') except Exception as e: print(' Exception: {} {}'.format(e.__class__.__name__, e))