lib/nicoquery/object/movie.rb in nicoquery-0.1.5 vs lib/nicoquery/object/movie.rb in nicoquery-0.1.6
- old
+ new
@@ -24,11 +24,11 @@
@source['mylist_rss'].presence ||
@source['tag_search_rss'].presence ||
@source['video_array'].presence ||
@source['gethumbinfo'].presence ||
Proc.new do
- source = (NicoQuery::Api::GetThumbInfo.new @video_id).get
+ source = (NicoQuery::Api::GetThumbInfo.new(@video_id || @thread_id)).get
set_getthumbinfo_source(NicoQuery::ObjectMapper::GetThumbInfo.new source)
end.call
source.send field_name
end
@@ -48,20 +48,24 @@
define_method(field_name) do
source =
@source['gethumbinfo'].presence ||
@source['video_array'].presence ||
Proc.new do
- source = (NicoQuery::Api::GetThumbInfo.new @video_id).get
+ source = (NicoQuery::Api::GetThumbInfo.new(@video_id || @thread_id)).get
set_getthumbinfo_source(NicoQuery::ObjectMapper::GetThumbInfo.new source)
end.call
source.send field_name
end
end
- def initialize(video_id)
+ def initialize(video_id_of_thread_id)
@source = {}
- @video_id = video_id
+ if video_id_of_thread_id.to_s.match(/sm|nm/)
+ @video_id = video_id_of_thread_id
+ else
+ @thread_id = video_id_of_thread_id
+ end
end
def set_getthumbinfo_source(source_object)
@source['getthumbinfo'] ||= source_object
end