Skip to content

Instantly share code, notes, and snippets.

@kenchan
Last active August 24, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenchan/a3492e8480f9992d46ff0fa6a354adf7 to your computer and use it in GitHub Desktop.
Save kenchan/a3492e8480f9992d46ff0fa6a354adf7 to your computer and use it in GitHub Desktop.
- 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