class NicoQuery::ObjectMapper::MylistRSS::Item

Public Class Methods

new(parsed_xml) click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 78
def initialize(parsed_xml)
  @hash = parsed_xml
end

Public Instance Methods

comment_num() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 118
def comment_num
  return nil if @hash == nil
  description.raw_text.scan(/(?<=nico-numbers-res\">)[0-9,]{1,}(?=\<\/strong)/)[0].delete(',').to_i
end
description() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 128
def description
  return nil if @hash == nil
  @_description ||= Description.new @hash['description']
end
length() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 133
def length
  return nil if @hash == nil
  description.raw_text.scan(/(?<=class\=\"nico\-info\-length\"\>)\d{1,}\:\d{1,2}(?=\<\/strong\>)/)
  length_string = $&.to_s.split(':')
  length_string[0].to_i * 60 + length_string[1].to_i
end
mylist_counter() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 123
def mylist_counter
  return nil if @hash == nil
  description.raw_text.scan(/(?<=nico-numbers-mylist\">)[0-9,]{1,}(?=\<\/strong)/)[0].delete(',').to_i
end
publish_date() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 102
def publish_date
  return nil if @hash == nil
  Time.parse @hash['pubDate']
end
thread_id() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 97
def thread_id
  return nil if @hash == nil
  @hash['guid'].scan(/(?<=watch\/)\d{1,}$/)[0].to_i
end
thumbnail_url() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 107
def thumbnail_url
  return nil if @hash == nil
  description.raw_text.scan(/(?<=src\=\").{1,}(?=\"\swidth)/)[0]
  $&
end
title() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 82
def title
  return nil if @hash == nil
  @hash['title']
end
url() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 92
def url
  return nil if @hash == nil
  @hash['link']
end
video_id() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 87
def video_id
  return nil if @hash == nil
  (url.scan(/((sm|nm)\d{1,})/).map {|e| e[0]})[0]
end
view_counter() click to toggle source
# File lib/nicoquery/object_mapper/mylist_rss.rb, line 113
def view_counter
  return nil if @hash == nil
  description.raw_text.scan(/(?<=nico-numbers-view\">)[0-9,]{1,}(?=\<\/strong)/)[0].delete(',').to_i
end