From 7774487951855cda0236d3014897a8c4afde3e64 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 12 Jan 2015 22:20:48 -0500 Subject: [PATCH] Initial commit --- bookmarksJsonParse | 3 +++ wallabag | 31 +++++++++++++++++++++++++++++++ wallabagBookmarks | 3 +++ 3 files changed, 37 insertions(+) create mode 100755 bookmarksJsonParse create mode 100755 wallabag create mode 100755 wallabagBookmarks diff --git a/bookmarksJsonParse b/bookmarksJsonParse new file mode 100755 index 0000000..cb7bd92 --- /dev/null +++ b/bookmarksJsonParse @@ -0,0 +1,3 @@ +#!/bin/sh +# this spits out URLs from a firefox bookmark json export, rather ugly... +python -m json.tool < "$1" | grep '^ *"uri": *"' | sed -e 's/^ *"uri": *"//' -e 's/"$//' \ No newline at end of file diff --git a/wallabag b/wallabag new file mode 100755 index 0000000..f48f036 --- /dev/null +++ b/wallabag @@ -0,0 +1,31 @@ +#!/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 diff --git a/wallabagBookmarks b/wallabagBookmarks new file mode 100755 index 0000000..f30cefa --- /dev/null +++ b/wallabagBookmarks @@ -0,0 +1,3 @@ +#!/bin/sh +# this imports all URLs from a firefox bookmark json export, to wallabag with tag 'bookmarks' +bookmarksJsonParse "$1" | xargs wallabag -t bookmarks \ No newline at end of file