Skip to content

Instantly share code, notes, and snippets.

@kenchan kenchan/feeds.yaml
Last active Aug 24, 2019

Embed
What would you like to do?
- https://www.hsbt.org/diary/no_comments.rdf
- https://diary.shu-cream.net/atom.xml
- https://june29.jp/index.xml
require 'rexml/document'
require 'rexml/element'
require 'yaml'
opml = REXML::Document.new
opml << REXML::XMLDecl.new('1.0', 'UTF-8')
# root opml element
root = REXML::Element.new('opml')
opml.add_element(root)
# head element
title = REXML::Element.new('title')
title.text = 'pepabo engineer blogs'
head = REXML::Element.new('head')
head.add_element(title)
root.add_element(head)
# body and outline elements
body = REXML::Element.new('body')
pepabo_outline = REXML::Element.new('outline')
pepabo_outline.add_attributes('text' => 'pepabo', 'title' => 'pepabo')
body.add_element(pepabo_outline)
root.add_element(body)
YAML.load_file(ARGV[0]).each do |url|
outline = REXML::Element.new('outline')
outline.add_attributes(
'type' => 'rss',
'xmlUrl' => url,
)
pepabo_outline.add_element(outline)
end
puts opml
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.