Skip to content

Commit

Permalink
use width, add video?
Browse files Browse the repository at this point in the history
  • Loading branch information
edsu committed Sep 10, 2023
1 parent 457d86b commit cf0406d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [ ] memento-cli
# memento-cli

A command line tool interacting with Memento ([RFC 7089](https://www.rfc-editor.org/rfc/rfc7089)) supporting web archives, such as the Internet Archive's Wayback Machine.

Expand Down Expand Up @@ -49,6 +49,8 @@ $ memento bisect --missing --text "women, people of color, lesbian, gay" \
https://web.archive.org/web/20230621094005/https://help.twitter.com/en/rules-and-policies/hateful-conduct-policy
```

<video src="https://raw.githubusercontent.com/edsu/memento-cli/main/images/memento.mp4"></video>

The *bisect* command uses a browser behind the scenes (using Selenium) in order to fully render the page. If you wanted to find out when some text appears (rather than goes missing) then remove the `--missing` parameter from the command.

And if you would prefer to examine the pages in between manually, leave off the `--text` parameter and *memento* will prompt you to continue, and show you the browser it is controlling.
Expand Down
Binary file added images/memento.mp4
Binary file not shown.
3 changes: 2 additions & 1 deletion memento_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ def list(url):
@click.option('--missing', is_flag=True, help='missing text to look for on the page')
@click.option('--show-browser', is_flag=True, help='see the browser')
def bisect(start_url, end_url, text, missing, show_browser):
print()
url = memento.bisect_urls(start_url, end_url, text, missing, show_browser)
click.echo(f'\rfound snapshot: {url}')
click.echo(f'\rFound your archive snapshot: {url}')


def main():
Expand Down
4 changes: 3 additions & 1 deletion memento_cli/memento.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
import shutil
import datetime
import requests
import requests.utils
Expand Down Expand Up @@ -103,7 +104,8 @@ def bisect(start, end, memento_urls, text, missing, browser) -> str:


def meter(start, end, n):
width = 40
# get the width of the progress bar (factoring in the leading counter)
width = shutil.get_terminal_size().columns - (len(str(n)) * 2 + 10)
scale = width / n
a = int((start + 1) * scale)
b = int((end - start + 1) * scale)
Expand Down

0 comments on commit cf0406d

Please sign in to comment.