Created
March 19, 2014 17:29
-
-
Save kimitoboku/9646915 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
require 'rexml/document' | |
require 'pp' | |
require 'open-uri' | |
require 'date' | |
MARKTAG = "もきゅ"; | |
user = "kimitoboku035" | |
doc = REXML::Document.new(open("http://b.hatena.ne.jp/#{user}/atomfeed?date=#{Time.now.strftime("%Y%m%d")}")); | |
pp "http://b.hatena.ne.jp/#{user}/atomfeed?date=#{Time.now.strftime("%Y%m%d")}" | |
elem = REXML::XPath.match(doc,'feed/entry'); | |
elem.each_with_index do |e,i| | |
flag = false; | |
puts("#{i}----------") | |
e.each_element('dc:subject') do |tag| | |
if(tag.text == MARKTAG) then | |
flag = true; | |
end | |
puts tag.text; | |
end | |
if(flag==true) then | |
e.each_element('title') do |title| | |
puts title.text; | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment