lib/nv/niconico/mylist.rb in nv-1.0.1 vs lib/nv/niconico/mylist.rb in nv-1.2.1
- old
+ new
@@ -20,11 +20,11 @@
def normalize(ptr)
ptr.match(/mylist\/([0-9]+)\??/)[1]
end
def fetch
- doc = REXML::Document.new(@agent.get("http://www.nicovideo.jp/mylist/#{@id}?rss=2.0").body)
+ doc = REXML::Document.new(open("http://www.nicovideo.jp/mylist/#{@id}?rss=2.0").read)
channel = doc.elements['/rss/channel']
items = []
channel.elements.each('item') do |item|
@@ -40,17 +40,17 @@
:html_description => html_description
})
end
@mylist = OpenStruct.new({
- :title => channel.elements['title/text()'],
- :link => channel.elements['link/text()'],
- :description => channel.elements['description/text()'],
- :created_at => channel.elements['pubDate/text()'],
- :updated_at => channel.elements['lastBuildDate/text()'],
- :generator => channel.elements['generator/text()'],
- :author => channel.elements['dc:creator/text()'],
- :language => channel.elements['language/text()'],
+ :title => channel.elements['title/text()'].to_s.gsub(/(^マイリスト\s|‐ニコニコ動画$)/, ''),
+ :link => channel.elements['link/text()'].to_s,
+ :description => channel.elements['description/text()'].to_s,
+ :created_at => channel.elements['pubDate/text()'].to_s,
+ :updated_at => channel.elements['lastBuildDate/text()'].to_s,
+ :generator => channel.elements['generator/text()'].to_s,
+ :author => channel.elements['dc:creator/text()'].to_s,
+ :language => channel.elements['language/text()'].to_s,
:items => items,
:items_count => items.size
})
end
end