-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not respecting showDupeCount=true; retry without --uniques-only #82
Comments
Thanks for your interest in
|
Okay, thank you. I'm not sure how often #!/usr/bin/env python3
"""Wrap waybackpack to copy files to a single directory."""
import argparse
import os
import shutil
import subprocess
def run_waybackpack(args):
"""Run waybackpack with the given arguments."""
command = ["waybackpack", "--dir", args.dir, "--delay-retry", str(args.delay_retry)]
if args.no_clobber:
command.append("--no-clobber")
if args.progress:
command.append("--progress")
command.extend(args.unknown)
try:
subprocess.run(command, check=True)
print("Waybackpack command executed successfully.")
except subprocess.CalledProcessError as e:
print(f"Error executing waybackpack: {e}")
return False
return True
def process_files(base_dir):
"""Create files rather than paths from waybackpack."""
for root, _, files in os.walk(base_dir):
for file in files:
if file.endswith(".html"):
original = os.path.join(root, file)
relative_path = os.path.relpath(original, base_dir)
new_filename = relative_path.replace(os.sep, "_")
new_file_path = os.path.join(base_dir, new_filename)
shutil.copy(original, new_file_path)
print(f"Copied {original} to {new_file_path}")
def main():
"""Process arguments and call waybackpack and file processing."""
parser = argparse.ArgumentParser(description="Waybackpack Wrapper")
parser.add_argument(
"--dir", type=str, default="wb", help="Directory for storing results"
)
parser.add_argument(
"--delay-retry", type=int, default=15, help="Delay between retries"
)
parser.add_argument(
"--no-clobber",
action="store_true",
default=True,
help="Do not overwrite existing files",
)
parser.add_argument(
"--progress", action="store_true", default=True, help="Show progress"
)
args, unknown = parser.parse_known_args()
args.unknown = unknown
if run_waybackpack(args):
process_files(args.dir)
if __name__ == "__main__":
main() |
I got the same error. I vaguely understand the explanation that this is a problem with the Wayback Machine's own API, and
...Ah, I get it, I had been parsing that message as "hocuspocus [is] not respecting I suggest improving the error message in three ways:
So the final fixed behavior would look like this mockup:
(The phrase "in this case" is super vague, of course, but I don't have the knowledge to improve its specificity.) |
Hi, I'm new to the tool, and don't want to download empty files or files which haven't changed. I tried and got the following. I'm not sure what this means and why it doesn't work...?
The text was updated successfully, but these errors were encountered: