Skip to content

Instantly share code, notes, and snippets.

@wosc
Created March 29, 2018 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wosc/9a54d822629f06afbb5f53ad2582abc0 to your computer and use it in GitHub Desktop.
Save wosc/9a54d822629f06afbb5f53ad2582abc0 to your computer and use it in GitHub Desktop.
Automated export of bookmarks from Shaarli
#!/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