check if article exists in archive already
- open url in browser to archive if not exists yet
This commit is contained in:
parent
8560fe020c
commit
780ac71855
@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
BASE_URL=https://archive.is/timegate
|
BASE_URL=https://archive.is/timegate
|
||||||
|
ARCHIVE_URL=https://archive.is/?url
|
||||||
BROWSER=firefox
|
BROWSER=firefox
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
@ -9,6 +12,11 @@ check() {
|
|||||||
echo "Please provide an article to archive" >&2
|
echo "Please provide an article to archive" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if https --verify no "$BASE_URL/$article" | grep -iq "archive this url"; then
|
||||||
|
echo "Article not found in archive... archiving now" >&2
|
||||||
|
$BROWSER "$ARCHIVE_URL=$article"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "o:p:" opt; do
|
while getopts "o:p:" opt; do
|
||||||
|
Loading…
Reference in New Issue
Block a user