Skip to content

Instantly share code, notes, and snippets.

@rudism
Created March 30, 2017 22:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rudism/27022cc6f77930ae4966231e91ae010f to your computer and use it in GitHub Desktop.
Save rudism/27022cc6f77930ae4966231e91ae010f to your computer and use it in GitHub Desktop.
Qutebrowser userscript to add current page to Pinboard.in bookmarks
#!/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
@markstos
Copy link

Thanks for this example.

I rewrote this using Fish instead of Bash and httpie instead of curl-- I just wanted to use some different tools for the job.

https://gist.github.com/markstos/65310a449e606d9a6112606556802301

@markstos
Copy link

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