implement restarting an extractor (#3338)

This commit is contained in:
Mike Fährmann
2023-02-11 21:06:14 +01:00
parent ce996dd21b
commit d4232f3a8b
4 changed files with 32 additions and 9 deletions

View File

@@ -250,9 +250,13 @@ def main():
pformat = config.get(("output",), "progress", True)
if pformat and len(urls) > 1 and args.loglevel < logging.ERROR:
urls = progress(urls, pformat)
else:
urls = iter(urls)
retval = 0
for url in urls:
url = next(urls, None)
while url is not None:
try:
log.debug("Starting %s for '%s'", jobtype.__name__, url)
if isinstance(url, util.ExtendedUrl):
@@ -264,9 +268,15 @@ def main():
retval |= jobtype(url).run()
except exception.TerminateExtraction:
pass
except exception.RestartExtraction:
log.debug("Restarting '%s'", url)
continue
except exception.NoExtractorError:
log.error("Unsupported URL '%s'", url)
retval |= 64
url = next(urls, None)
return retval
except KeyboardInterrupt: