Created
March 29, 2018 12:01
-
-
Save wosc/9a54d822629f06afbb5f53ad2582abc0 to your computer and use it in GitHub Desktop.
Automated export of bookmarks from Shaarli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Export bookmarks from Shaarli <https://github.com/shaarli/Shaarli> in Netscape HTML format. | |
# Adapted from <https://github.com/nodiscc/shaarchiver> | |
url=$1 | |
user=$2 | |
pass=$3 | |
cookies=$(mktemp) | |
curl="curl -s --cookie-jar $cookies --cookie $cookies" | |
token=$($curl "$url/?do=login" | | |
sed -ne 's/^.*name="token" value="\([^"]*\)".*$/\1/p' | head -n1) | |
$curl -XPOST "$url/?do=login" -d "login=$user&password=$pass&token=$token" | |
$curl "$url/?do=export&selection=all" | |
rm -f $cookies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment