Send an entire feed to Pinboard

Recently I’ve set an IFTTT action to send all my liked articles from Instapaper to Pinboard1. However, the action can’t cover the entries I liked in the past. Thinking about it, I wrote a python script you can run on Pythonista to send an entire feed to Pinboard.

Use this action carefully, I really meant when I said it will send the whole feed to Pinboard. Don’t blame me if it doesn’t run smoothly if you apply it to an enormous feed. It’s the kind of script you won’t have to use more than once for each feed you’d like to archive. Also, If you try to add a link already stored in Pinboard, it’ll be replaced. So be careful not to ruin your tag system.

import feedparser
import urllib
import bs4

# Get your token at:
token = 'login:stringofnumbers'

# Add the link for the RSS you'd like to send to Pinboard
rss = ''

print 'Loading feed...'
feed = feedparser.parse(rss)
entries = feed['entries']

for entry in entries:
    query = '' + token + '&url=' + urllib.quote(entry['link']) + '&description=' + urllib.quote(entry['title'].encode('utf-8')) + '&tags=starred' #replace the ‘starred’ with other tag you want, remember to apply a urllib.quote if it has spaces or anything. It would look like this '&tags=' + urllib.quote('new tag').
    pinboard = bs4.BeautifulSoup(urllib.urlopen(query))
    print 'Added to Pinboard: ' + entry['title']

You’ll probably find your way with the instructions in the script. You can grab your Pinboard API token here. Also replace the RSS placeholder, which contains this blog’s feed link2 with the feed you want to add. If you’re looking for your Liked articles’ feed on Instapaper, check the top right corner of the screen, as the image shows:

This workflow was made based on the scripts by Jack Bilbrey to post to Pinboard using your API token , and by Ole Zorn, introducing Pythonista users to the feedparser module.

  1. If you join Pinboard or upgrade your account in the next 2 days, you’ll support the Lavabit’s legal funding. If you praise a better web, the time to take action is now. 

  2. Or add all my articles to your Pinboard, I could appreciate that.