Created
July 19, 2012 01:42
-
-
Save shunsugai/3140214 to your computer and use it in GitHub Desktop.
RSSがWellformedかどうかを調べる
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
#coding: UTF-8 | |
require 'rss' | |
class RSSChecker | |
def initialize | |
@blogs = | |
[ | |
"http://lifehack2ch.livedoor.biz/index.rdf", | |
"http://www.scienceplus2ch.com/index.rdf", | |
"http://blog.livedoor.jp/domesaka/index.rdf", | |
"http://animalch.2chblog.jp/index.rdf", | |
"http://feed.rssad.jp/rss/fc2/yaraon.blog109", | |
"http://kanasoku.blog82.fc2.com/?xml", | |
"http://2r.ldblog.jp/index.rdf", | |
"http://chaos2ch.com/index.rdf", | |
"http://hamusoku.com/index.rdf", | |
"http://blog.esuteru.com/index.rdf", | |
"http://blog.livedoor.jp/dqnplus/index.rdf", | |
"http://alfalfalfa.com/index.rdf", | |
"http://blog.livedoor.jp/news23vip/index.rdf", | |
"http://news4vip.livedoor.biz/index.rdf", | |
"http://bipblog.com/index.rdf", | |
"http://www.google.co.jp", #Error | |
"http://mudainodqnment.ldblog.jp/index.rdf", | |
"http://blog.livedoor.jp/himasoku123/index.rdf", | |
"http://blog.livedoor.jp/goldennews/index.rdf", | |
"http://jin115.com/index.rdf" | |
] | |
end | |
def check | |
@blogs.each do |url| | |
begin | |
rss = RSS::Parser.parse(url) | |
rescue RSS::Error => e | |
puts "#{e.class} : #{url}" | |
next | |
end | |
end | |
end | |
if __FILE__ == $0 | |
new.check | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment