Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Convert your feedly OPML file to a markdown file
- #Usage:
- #ruby opml_to_markdown.rb FEEDLY_OPML_PATH
- require 'nokogiri'
- markdownContent = ""
- opmlFile = File.open(ARGV[0])
- opmlDoc = Nokogiri::XML(opmlFile)
- markdownName = opmlDoc.xpath('//head/title').text
- opmlDoc.xpath('//body/outline').each do |dirOutline|
- markdownContent << "\n" + "###" + dirOutline.attr('title') + "\n"
- dirOutline.children.each do |rss|
- markdownContent << "* [%s](%s)\n" % [rss.attr('title'),rss.attr('xmlUrl')] unless rss.to_s.include? "\n"
- end
- end
- File.open("#{markdownName}.md","w+") { |file| file << markdownContent}
Add Comment
Please, Sign In to add comment