From 1b3710f9586acca56c8384afe60e51b5ae16fe36 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 6 Dec 2017 11:45:51 +0100 Subject: Add flags to disable screenshot/DOM snapshot --- crocoite/cli.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'crocoite') diff --git a/crocoite/cli.py b/crocoite/cli.py index 52d3b27..62f488a 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -146,6 +146,8 @@ def main (): #parser.add_argument('--keep-tab', action='store_true', default=False, dest='keepTab', help='Keep tab open') parser.add_argument('--onload', default=[], action='append', help='Inject JavaScript file before loading page', metavar='FILE') parser.add_argument('--onsnapshot', default=[], action='append', help='Run JavaScript files before creating DOM snapshot', metavar='FILE') + parser.add_argument('--no-screenshot', default=True, action='store_false', help='Do not create a screenshot of the website', dest='screenshot') + parser.add_argument('--no-dom-snapshot', default=True, action='store_false', help='Do not create a DOM snapshot of the website', dest='domSnapshot') parser.add_argument('url', help='Website URL') parser.add_argument('output', help='WARC filename') @@ -191,12 +193,14 @@ def main (): l.stop () - script = loadScripts (args.onsnapshot) - writeScript ('onsnapshot', script, writer) - l.tab.Runtime.evaluate (expression=script, returnByValue=True) - writeDOMSnapshot (l.tab, writer) + if args.domSnapshot: + script = loadScripts (args.onsnapshot) + writeScript ('onsnapshot', script, writer) + l.tab.Runtime.evaluate (expression=script, returnByValue=True) + writeDOMSnapshot (l.tab, writer) - writeScreenshot (l.tab, writer) + if args.screenshot: + writeScreenshot (l.tab, writer) return True -- cgit v1.2.3