diff --git a/archivebox/cli/archivebox_oneshot.py b/archivebox/cli/archivebox_oneshot.py index 8d5bb173..86a0fae6 100644 --- a/archivebox/cli/archivebox_oneshot.py +++ b/archivebox/cli/archivebox_oneshot.py @@ -47,7 +47,7 @@ def main(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional stdin_url = accept_stdin(stdin) if (stdin_url and url) or (not stdin and not url): stderr( - '[X] You must pass URLs/paths to add via stdin or CLI arguments.\n', + '[X] You must pass URL/path to add via stdin or CLI arguments.\n', color='red', ) raise SystemExit(2) @@ -59,4 +59,4 @@ def main(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional if __name__ == '__main__': - main(args=sys.argv[1:], stdin=sys.stdin) \ No newline at end of file + main(args=sys.argv[1:], stdin=sys.stdin) diff --git a/archivebox/extractors/__init__.py b/archivebox/extractors/__init__.py index 62743af2..99a79278 100644 --- a/archivebox/extractors/__init__.py +++ b/archivebox/extractors/__init__.py @@ -123,7 +123,7 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s @enforce_types -def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[Iterable[str]]=None, out_dir: Optional[str]=None, skip_index: bool=False, oneshot: bool=False) -> List[Link]: +def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[Iterable[str]]=None, out_dir: Optional[str]=None) -> List[Link]: if not links: return [] @@ -132,11 +132,7 @@ def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[It link: Link = links[0] try: for idx, link in enumerate(links): - if oneshot: - link_out_dir = out_dir or link.link_dir - else: - link_out_dir = link.link_dir - archive_link(link, overwrite=overwrite, methods=methods, out_dir=link_out_dir, skip_index=skip_index) + archive_link(link, overwrite=overwrite, methods=methods, out_dir=link.link_dir) except KeyboardInterrupt: log_archiving_paused(len(links), idx, link.timestamp) raise SystemExit(0) diff --git a/archivebox/main.py b/archivebox/main.py index b642cce4..8a4c4971 100644 --- a/archivebox/main.py +++ b/archivebox/main.py @@ -52,7 +52,7 @@ from .index.sql import ( remove_from_sql_main_index, ) from .index.html import parse_html_main_index -from .extractors import archive_links +from .extractors import archive_links, archive_link from .config import ( stderr, ConfigDict, @@ -496,10 +496,15 @@ def status(out_dir: str=OUTPUT_DIR) -> None: @enforce_types def oneshot(url: str, out_dir: str=OUTPUT_DIR): - oneshot_links, _ = parse_links_memory([url]) - oneshot_links, _ = dedupe_links([], oneshot_links) - archive_links(oneshot_links, out_dir=out_dir, skip_index=True, oneshot=True) - return oneshot_links + oneshot_link, _ = parse_links_memory([url]) + if len(oneshot_link) > 1: + stderr( + '[X] You should pass a single url to the oneshot command', + color='red' + ) + raise SystemExit(2) + archive_link(oneshot_link[0], out_dir=out_dir, skip_index=True) + return oneshot_link @enforce_types def add(urls: Union[str, List[str]],