Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Send entire feed to Pinboard
#coding: utf-8
import feedparser
import urllib
import bs4
import keychain
import console
import pickle
# Get your token at:
token = keychain.get_password('pinboardapitoken','pinboard')
if token is not None:
token = pickle.loads(token)
token = pickle.dumps(console.input_alert('Pinboard API Token'))
keychain.set_password('pinboardapitoken', 'pinboard', token)
# Add the link for the RSS you'd like to send to Pinboard
rss = console.input_alert('RSS feed URL')
print 'Loading feed...'
feed = feedparser.parse(rss)
entries = feed['entries']
#replace the ‘starred’ with other tag you want.
tags = urllib.quote('starred')
for entry in entries:
query = '' + token + '&url=' + urllib.quote(entry['link']) + '&description=' + urllib.quote(entry['title'].encode('utf-8')) + '&tags=' + tags
pinboard = bs4.BeautifulSoup(urllib.urlopen(query))
print 'Added to Pinboard: ' + entry['title']
print 'Success! Added all available feed articles!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.