You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
666 B
31 lines
666 B
#!/bin/bash |
|
|
|
# put your login credentials in ~/.netrc |
|
# put your url here, or export wallabag_url in your .bashrc or something |
|
#wallabag_url="https://example.org/wallabag/" |
|
|
|
tags='' |
|
if [ "$1" = '--tags' ] || [ "$1" = '-t' ] |
|
then |
|
shift |
|
tags="&tags=$1" |
|
shift |
|
fi |
|
|
|
cookies="$(mktemp)" |
|
trap 'rm -f "$cookies"' EXIT |
|
|
|
# login |
|
curl --netrc --cookie-jar "$cookies" "$wallabag_url" &>/dev/null || exit $? |
|
|
|
while [[ $# > 0 ]] |
|
do |
|
url="$1" |
|
b64="$(echo -n "$url" | base64 --wrap=0)" |
|
full_url="$wallabag_url?action=add$tags&url=$b64" |
|
#echo "url: $url b64: $b64 full_url: $full_url" |
|
|
|
curl --netrc --cookie "$cookies" "$full_url" &>/dev/null || exit $? |
|
|
|
shift |
|
done
|
|
|