Skip to content

Instantly share code, notes, and snippets.

Last active April 27, 2016 03:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Simple conversion from podcast subscription OPML file into Markdown text
Convert podcast OPML file into Markdown format suitable for blog posting
Brian Cantoni
import opml
import codecs
import locale
import sys
# Wrap sys.stdout into a StreamWriter to allow writing unicode.
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
if len(sys.argv) < 2:
sys.stderr.write("Usage: input.opml\n")
o = opml.parse(sys.argv[1])
print u"## %s\n" % o.title
for f in o:
print u"[** %s **](%s) [[%s](%s)] \n" % (f.text, f.htmlUrl, f.type, f.xmlUrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment