Welcome to another automation post! This is a super simple Python script for changing misspelled or wrong tags in your Pinboard account. I started using Pinboard again because it helps me save all these great articles I read on the Interwebz, so I can paraphrase and regurgitate them back to you. Ha!
I need to clean out the Pinboard tags every so often because I hooked it up to Twitter. It works well for me because it saves all my retweets, favs and posts, but there’s a lot of noise. Sometimes I end up with tags like “DataScience” and “DataScientists” when I really want “DataScience.” I did some searching around and found the Pinboard Python library. Changing Pinboard tags with Python is EASY!
What you do need to do is install the Python package for Pinboard and get an API key from your Settings page. Then it’s as simple as doing this:
pb = pinboard.Pinboard('INSERT_YOUR_API_KEY_HERE')
old_tag = 'DataMining'
new_tag = 'DataScience'
You can, of course modify this script to pass command line arguments to it and just do something like this:
passcode = str(input('Enter your Pinboard API key here: '))
pb = pinboard.Pinboard(passcode)
old_tag = str(input('Enter the old tag: '))
new_tag = str(input('Enter the new tag: '))
print ('Converted: ' + old_tag+ ' to: ' + new_tag)
Once again, the second script is all open source and free for you to use/modify as you see fit.
Note: I just regurgitated the original script (first one) and then riffed on it for the second one. The Author of Pinboard provided a sample in the documentation. Check that out too!
From around the Social Web!
Want to leave a comment?
If you want to give me some feedback on this post, please contact me
via email or on Twitter