Last active
August 24, 2019 09:36
-
-
Save kenchan/a3492e8480f9992d46ff0fa6a354adf7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- https://www.hsbt.org/diary/no_comments.rdf | |
- https://diary.shu-cream.net/atom.xml | |
- https://june29.jp/index.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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