diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2018-05-04 13:05:37 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2018-05-04 16:00:05 +0200 |
commit | 2f5cc22dc3277de7a22b9839ff3c42ed40ff50b0 (patch) | |
tree | 419020fec903a4fe0be9929eccfad0eed2a5c027 /crocoite | |
parent | 824c6e91ae6fee1318e79c3ce1a43f98bc697c7b (diff) | |
download | crocoite-2f5cc22dc3277de7a22b9839ff3c42ed40ff50b0.tar.gz crocoite-2f5cc22dc3277de7a22b9839ff3c42ed40ff50b0.tar.bz2 crocoite-2f5cc22dc3277de7a22b9839ff3c42ed40ff50b0.zip |
Support --browser again for local crawls
Broken by commit 75019eac4545bb2e8b90033834e91beef614cdf3
Diffstat (limited to 'crocoite')
-rw-r--r-- | crocoite/browser.py | 2 | ||||
-rw-r--r-- | crocoite/cli.py | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crocoite/browser.py b/crocoite/browser.py index 9e59556..e58ebcf 100644 --- a/crocoite/browser.py +++ b/crocoite/browser.py @@ -409,7 +409,7 @@ class NullService: self.url = url def __enter__ (self): - return url + return self.url def __exit__ (self, *exc): pass diff --git a/crocoite/cli.py b/crocoite/cli.py index 15fac12..efd30ad 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -27,6 +27,7 @@ import logging, argparse, json, sys from . import behavior from .controller import RecursiveController, defaultSettings, \ ControllerSettings, DepthLimit, PrefixLimit +from .browser import NullService, ChromeService def main (): parser = argparse.ArgumentParser(description='Save website to WARC using Google Chrome.') @@ -70,12 +71,15 @@ def main (): recursionPolicy = PrefixLimit (args.url) else: parser.error ('Invalid argument for --recursive') + service = ChromeService () + if args.browser: + service = NullService (args.browser) settings = ControllerSettings (maxBodySize=args.maxBodySize, logBuffer=args.logBuffer, idleTimeout=args.idleTimeout, timeout=args.timeout) with open (args.output, 'wb') as fd: controller = RecursiveController (args.url, fd, settings=settings, - recursionPolicy=recursionPolicy) + recursionPolicy=recursionPolicy, service=service) r = controller.run () json.dump (r, sys.stdout) |