summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crocoite/browser.py2
-rw-r--r--crocoite/cli.py6
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)