Created
March 30, 2017 22:39
-
-
Save rudism/27022cc6f77930ae4966231e91ae010f to your computer and use it in GitHub Desktop.
Qutebrowser userscript to add current page to Pinboard.in bookmarks
This file contains 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/sh | |
# Uncomment and add your pinboard token here or export it globally somewhere | |
# PINBOARD_API_TOKEN="username:token" | |
# Put this file in ~/.local/share/qutebrowser/userscripts and chmod +x | |
# Run it from Qutebrowser with :spawn --userscript qutebrowser-pinboard.sh | |
# Bind it to "A" key with :bind --mode normal A spawn --userscript qutebrowser-pinboard.sh | |
API_HOST="https://api.pinboard.in/v1" | |
CURL_OPTS="--http1.1 --ipv4 --tlsv1.2 --ciphers ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-SHA384,DH-RSA-AES256-GCM-SHA384,DHE-RSA-AES256-GCM-SHA384,DHE-RSA-AES256-SHA256,ECDH-RSA-AES256-GCM-SHA384,ECDH-RSA-AES256-SHA384,AES256-GCM-SHA384" | |
echo "message-info \"Pinboard - Saving: $QUTE_URL\"" >> $QUTE_FIFO | |
result=$(curl $CURL_OPTS -G "$API_HOST/posts/add" --data auth_token=$PINBOARD_API_TOKEN --data format=json --data-urlencode "url=$QUTE_URL" --data-urlencode "description=$QUTE_TITLE" -H 'Content-Type: application/json' -H 'Accept: application/json') | |
echo "message-info \"Pinboard - ${result//\"/\\\"}\"" >> $QUTE_FIFO |
I also updated my fork to open Pinboard after posting, to potentially add a description or tags.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this example.
I rewrote this using Fish instead of Bash and
httpie
instead ofcurl
-- I just wanted to use some different tools for the job.https://gist.github.com/markstos/65310a449e606d9a6112606556802301