nicoquery 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/lib/nicoquery/api/base.rb +1 -0
- data/lib/nicoquery/crawler/bulk_scraping.rb +26 -0
- data/lib/nicoquery/object/movie.rb +16 -12
- data/lib/nicoquery/object_mapper/description.rb +33 -0
- data/lib/nicoquery/object_mapper/getthumbinfo.rb +1 -29
- data/lib/nicoquery/object_mapper/video_array.rb +91 -0
- data/lib/nicoquery/version.rb +1 -1
- data/spec/crawler/bulk_scraping_spec.rb +22 -0
- data/spec/fixture/video_array_sm20415650_sm9.rb +162 -0
- data/spec/object_mapper/video_array_spec.rb +80 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca158c44cc72e7049c898420e7ffba6103597f29
|
4
|
+
data.tar.gz: f3739a64afefb330dc656da817fced37395ab8a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1c7a8a6bbc4ad018e3e163894132723e0ec418461c5db246192bc35330a414ee6226d30c5162ce22512526d58e40d56a7eb1c4b9b3c219d93d10bbe049d0e53
|
7
|
+
data.tar.gz: 1da1f503601a31044202ae2f0e48af28f841cc797d6311f4e2d2f19d7db79ae163c77b8171b05eb1f94bddc5d66412c323d36c21310b753bbf49010a7e22dda3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nicoquery (0.0
|
4
|
+
nicoquery (0.1.0)
|
5
5
|
activesupport (~> 4.0.0)
|
6
6
|
i18n
|
7
7
|
nicoapi
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
thread_safe (~> 0.1)
|
20
20
|
tzinfo (~> 0.3.37)
|
21
21
|
addressable (2.3.5)
|
22
|
-
atomic (1.1.
|
22
|
+
atomic (1.1.14)
|
23
23
|
coderay (1.0.9)
|
24
24
|
crack (0.4.1)
|
25
25
|
safe_yaml (~> 0.9.0)
|
@@ -42,10 +42,10 @@ GEM
|
|
42
42
|
rb-kqueue (>= 0.2)
|
43
43
|
lumberjack (1.0.4)
|
44
44
|
method_source (0.8.2)
|
45
|
-
mime-types (
|
46
|
-
mini_portile (0.5.
|
45
|
+
mime-types (2.0)
|
46
|
+
mini_portile (0.5.2)
|
47
47
|
minitest (4.7.5)
|
48
|
-
multi_json (1.
|
48
|
+
multi_json (1.8.2)
|
49
49
|
nicoapi (0.0.6.1)
|
50
50
|
activesupport (~> 4.0.0)
|
51
51
|
i18n
|
@@ -76,9 +76,9 @@ GEM
|
|
76
76
|
safe_yaml (0.9.5)
|
77
77
|
slop (3.4.6)
|
78
78
|
thor (0.18.1)
|
79
|
-
thread_safe (0.1.
|
79
|
+
thread_safe (0.1.3)
|
80
80
|
atomic
|
81
|
-
tzinfo (0.3.
|
81
|
+
tzinfo (0.3.38)
|
82
82
|
watchr (0.7)
|
83
83
|
webmock (1.13.0)
|
84
84
|
addressable (>= 2.2.7)
|
data/lib/nicoquery/api/base.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "nicoquery/api/video_array"
|
2
|
+
require "nicoquery/object_mapper/video_array"
|
3
|
+
require "nicoquery/object/movie"
|
4
|
+
require "nori"
|
5
|
+
require "pry"
|
6
|
+
|
7
|
+
|
8
|
+
module NicoQuery
|
9
|
+
module Crawler
|
10
|
+
module BulkScraping
|
11
|
+
def execute(id_array, &block)
|
12
|
+
@movies = []
|
13
|
+
source = (NicoQuery::Api::VideoArray.new id_array).get
|
14
|
+
@hash = NicoQuery::ObjectMapper::VideoArray.new source
|
15
|
+
|
16
|
+
@hash.movies.each do |movie|
|
17
|
+
m = NicoQuery::Object::Movie.new movie.video_id
|
18
|
+
m.set_video_array_source movie
|
19
|
+
block.call m
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module_function :execute
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -21,6 +21,7 @@ module NicoQuery
|
|
21
21
|
source =
|
22
22
|
@source['mylist_rss'].presence ||
|
23
23
|
@source['tag_search_rss'].presence ||
|
24
|
+
@source['video_array'].presence ||
|
24
25
|
@source['gethumbinfo'].presence ||
|
25
26
|
Proc.new do
|
26
27
|
source = (NicoQuery::Api::GetThumbInfo.new @video_id).get
|
@@ -33,13 +34,13 @@ module NicoQuery
|
|
33
34
|
|
34
35
|
[
|
35
36
|
'movie_type',
|
36
|
-
'size_high',
|
37
|
+
# 'size_high',
|
37
38
|
'size_low',
|
38
|
-
'last_res_body',
|
39
|
-
'thumb_type',
|
40
|
-
'embeddable',
|
41
|
-
'no_live_play',
|
42
|
-
'user_id',
|
39
|
+
# 'last_res_body',
|
40
|
+
# 'thumb_type',
|
41
|
+
# 'embeddable',
|
42
|
+
# 'no_live_play',
|
43
|
+
# 'user_id',
|
43
44
|
'tags',
|
44
45
|
].each do |field_name|
|
45
46
|
define_method(field_name) do
|
@@ -60,18 +61,21 @@ module NicoQuery
|
|
60
61
|
@video_id = video_id
|
61
62
|
end
|
62
63
|
|
63
|
-
def set_getthumbinfo_source(
|
64
|
-
@source['getthumbinfo'] ||=
|
64
|
+
def set_getthumbinfo_source(source_object)
|
65
|
+
@source['getthumbinfo'] ||= source_object
|
65
66
|
end
|
66
67
|
|
67
|
-
def set_mylist_rss_source(
|
68
|
-
@source['mylist_rss'] ||=
|
68
|
+
def set_mylist_rss_source(source_object)
|
69
|
+
@source['mylist_rss'] ||= source_object
|
69
70
|
end
|
70
71
|
|
71
|
-
def set_tag_search_rss_source(
|
72
|
-
@source['tag_search_rss'] ||=
|
72
|
+
def set_tag_search_rss_source(source_object)
|
73
|
+
@source['tag_search_rss'] ||= source_object
|
73
74
|
end
|
74
75
|
|
76
|
+
def set_video_array_source(source_object)
|
77
|
+
@source['video_array'] ||= source_object
|
78
|
+
end
|
75
79
|
end
|
76
80
|
end
|
77
81
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module NicoQuery
|
2
|
+
module ObjectMapper
|
3
|
+
class Description
|
4
|
+
attr_reader :raw_text, :movie_references, :movie_references,
|
5
|
+
:community_references, :seiga_references
|
6
|
+
|
7
|
+
def initialize(raw_text)
|
8
|
+
@raw_text = raw_text.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def text
|
12
|
+
@raw_text
|
13
|
+
end
|
14
|
+
|
15
|
+
def movie_references
|
16
|
+
# is this the high road?
|
17
|
+
text.scan(/((sm|nm)\d{1,})/).map {|e| e[0]}
|
18
|
+
end
|
19
|
+
|
20
|
+
def mylist_references
|
21
|
+
text.scan(/(?<=mylist\/)\d{1,}/).map(&:to_i)
|
22
|
+
end
|
23
|
+
|
24
|
+
def community_references
|
25
|
+
text.scan(/co\d{1,}/)
|
26
|
+
end
|
27
|
+
|
28
|
+
def seiga_references
|
29
|
+
text.scan(/im\d{1,}/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "nori"
|
2
|
+
require "nicoquery/object_mapper/description"
|
2
3
|
|
3
4
|
|
4
5
|
module NicoQuery
|
@@ -112,35 +113,6 @@ module NicoQuery
|
|
112
113
|
|
113
114
|
{ text: text, lock: lock }
|
114
115
|
end
|
115
|
-
|
116
|
-
class Description
|
117
|
-
attr_reader :raw_text
|
118
|
-
|
119
|
-
def initialize(raw_text)
|
120
|
-
@raw_text = raw_text.to_s
|
121
|
-
end
|
122
|
-
|
123
|
-
def text
|
124
|
-
@raw_text
|
125
|
-
end
|
126
|
-
|
127
|
-
def movie_references
|
128
|
-
# is this the high road?
|
129
|
-
text.scan(/((sm|nm)\d{1,})/).map {|e| e[0]}
|
130
|
-
end
|
131
|
-
|
132
|
-
def mylist_references
|
133
|
-
text.scan(/(?<=mylist\/)\d{1,}/).map(&:to_i)
|
134
|
-
end
|
135
|
-
|
136
|
-
def community_references
|
137
|
-
text.scan(/co\d{1,}/)
|
138
|
-
end
|
139
|
-
|
140
|
-
def seiga_references
|
141
|
-
text.scan(/im\d{1,}/)
|
142
|
-
end
|
143
|
-
end
|
144
116
|
end
|
145
117
|
end
|
146
118
|
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require "nori"
|
2
|
+
require "nicoquery/object_mapper/description"
|
3
|
+
|
4
|
+
|
5
|
+
module NicoQuery
|
6
|
+
module ObjectMapper
|
7
|
+
class VideoArray
|
8
|
+
attr_reader :movies
|
9
|
+
|
10
|
+
def initialize(xml)
|
11
|
+
parser = Nori.new
|
12
|
+
parsed_xml = parser.parse xml
|
13
|
+
entire = parsed_xml['nicovideo_video_response']
|
14
|
+
|
15
|
+
if entire['video_info'].is_a? Array
|
16
|
+
@movies = entire['video_info'].each_with_object([]) do |movie, array|
|
17
|
+
array << Video.new(movie)
|
18
|
+
end
|
19
|
+
elsif entire['video_info'].nil?
|
20
|
+
@movies = []
|
21
|
+
else
|
22
|
+
# noriは子要素が複数の場合は配列に変換するが、1つの場合には配列にしない。
|
23
|
+
# しかし、MylistRSSはitemsが配列であること前提にしているので、item要素が
|
24
|
+
# 1つだけの場合にも配列に変換する必要がある。
|
25
|
+
@movies = [ Video.new(entire['video_info']) ]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Video
|
30
|
+
def initialize(parsed_xml)
|
31
|
+
@hash = parsed_xml
|
32
|
+
end
|
33
|
+
|
34
|
+
def video_id
|
35
|
+
@hash['video']['id']
|
36
|
+
end
|
37
|
+
|
38
|
+
def title
|
39
|
+
@hash['video']['title']
|
40
|
+
end
|
41
|
+
|
42
|
+
def description
|
43
|
+
@_description ||= Description.new @hash['video']['description']
|
44
|
+
end
|
45
|
+
|
46
|
+
def thumbnail_url
|
47
|
+
@hash['video']['thumbnail_url']
|
48
|
+
end
|
49
|
+
|
50
|
+
def first_retrieve
|
51
|
+
@hash['video']['first_retrieve'].to_time
|
52
|
+
end
|
53
|
+
|
54
|
+
def publish_date # alias
|
55
|
+
first_retrieve
|
56
|
+
end
|
57
|
+
|
58
|
+
def length
|
59
|
+
string = @hash['video']['length'].split(':')
|
60
|
+
string[0].to_i * 60 + string[1].to_i
|
61
|
+
end
|
62
|
+
|
63
|
+
def movie_type
|
64
|
+
@hash['video']['movie_type']
|
65
|
+
end
|
66
|
+
|
67
|
+
def view_counter
|
68
|
+
@hash['video']['view_counter'].to_i
|
69
|
+
end
|
70
|
+
|
71
|
+
def comment_num
|
72
|
+
@hash['video']['comment_num'].to_i
|
73
|
+
end
|
74
|
+
|
75
|
+
def mylist_counter
|
76
|
+
@hash['video']['mylist_counter'].to_i
|
77
|
+
end
|
78
|
+
|
79
|
+
def size_low
|
80
|
+
@hash['video']['size_low'].to_i
|
81
|
+
end
|
82
|
+
|
83
|
+
def tags
|
84
|
+
@hash['tags']['tag_info'].each_with_object([]) do |tag, array|
|
85
|
+
array << { text: tag['tag'] }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/lib/nicoquery/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "nicoquery/crawler/bulk_scraping"
|
2
|
+
|
3
|
+
|
4
|
+
describe "NicoQuery::Crawler" do
|
5
|
+
describe "VideoArray" do
|
6
|
+
before do
|
7
|
+
@acquired_movies = []
|
8
|
+
|
9
|
+
NicoQuery::Crawler::BulkScraping.execute(['sm20415650', 'sm9']) do |result|
|
10
|
+
@acquired_movies.push result
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should sorted by published date" do
|
15
|
+
expect(@acquired_movies[0].publish_date).to be
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should scrape movie's info the number of times -1 that returns :continue" do
|
19
|
+
expect(@acquired_movies.length).to eq 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
module Fixture
|
2
|
+
def self.video_array_sm20415650_sm9
|
3
|
+
<<-EOS
|
4
|
+
<nicovideo_video_response status="ok">
|
5
|
+
<count>2</count>
|
6
|
+
<video_info>
|
7
|
+
<video>
|
8
|
+
<id>sm20415650</id>
|
9
|
+
<deleted>0</deleted>
|
10
|
+
<title>【Minecraft】まったりクラフター生活 ~最終日~【ゆっくり実況】</title>
|
11
|
+
<description>最終日。<br /><br />ひっそりまったり通常営業...かな?<br />ついにきました最終日。最後に最長の尺...画質が悪いかもです><<br />今まで本当にありがとうございました!最後にゆっくりまったりしていってね(*´ヮ`*)<br /><br />シード値:-2086770116<br /><br />使用MOD<br />1.Opti Fine<br />2.MinecraftIM<br />3.PlayerFormLittleMaid<br />4.Audiotori r2<br />5.littleMaidMob<br />+りばいあ製MOD×2(らいちんぐすてっき・ゆかり&らいちロボ)<br /><br />sm20221817←29日目⇔新シリーズ→sm21615389<br /><br />シリーズまとめ→mylist/29017292<br />他に作ったもの→mylist/29022355<br /><br />twitter⇒http://twitter.com/raichi_J<br />コミュco1590050<br /><br />いただいたイラストclip/577830<br />ゆかりテクスチャim2807664<br />moyuさん作・ゆかりさんと私のメイドモデルim2466837</description>
|
12
|
+
<length_in_seconds>1469</length_in_seconds>
|
13
|
+
<size_low>77315257</size_low>
|
14
|
+
<movie_type>mp4</movie_type>
|
15
|
+
<thumbnail_url>http://tn-skr3.smilevideo.jp/smile?i=20415650</thumbnail_url>
|
16
|
+
<upload_time/>
|
17
|
+
<first_retrieve>2013-03-23T23:10:32+09:00</first_retrieve>
|
18
|
+
<default_thread>1364047834</default_thread>
|
19
|
+
<view_counter>27330</view_counter>
|
20
|
+
<mylist_counter>701</mylist_counter>
|
21
|
+
<option_flag_ichiba>0</option_flag_ichiba>
|
22
|
+
<option_flag_community>0</option_flag_community>
|
23
|
+
<option_flag_domestic>0</option_flag_domestic>
|
24
|
+
<option_flag_comment_type>0</option_flag_comment_type>
|
25
|
+
<option_flag_adult>0</option_flag_adult>
|
26
|
+
<option_flag_mobile>0</option_flag_mobile>
|
27
|
+
<option_flag_economy_mp4>1</option_flag_economy_mp4>
|
28
|
+
<option_flag_middle_video>0</option_flag_middle_video>
|
29
|
+
<option_flag_mobile_ng_apple>0</option_flag_mobile_ng_apple>
|
30
|
+
</video>
|
31
|
+
<thread>
|
32
|
+
<id>1364047834</id>
|
33
|
+
<public>1</public>
|
34
|
+
<num_res>2221</num_res>
|
35
|
+
<community_id/>
|
36
|
+
</thread>
|
37
|
+
<tags>
|
38
|
+
<tag_info>
|
39
|
+
<tag>ゲーム</tag>
|
40
|
+
<area>jp</area>
|
41
|
+
</tag_info>
|
42
|
+
<tag_info>
|
43
|
+
<tag>Minecraft</tag>
|
44
|
+
<area>jp</area>
|
45
|
+
</tag_info>
|
46
|
+
<tag_info>
|
47
|
+
<tag>ゆっくり実況プレイ</tag>
|
48
|
+
<area>jp</area>
|
49
|
+
</tag_info>
|
50
|
+
<tag_info>
|
51
|
+
<tag>VOICEROID+_結月ゆかり</tag>
|
52
|
+
<area>jp</area>
|
53
|
+
</tag_info>
|
54
|
+
<tag_info>
|
55
|
+
<tag>VOICEROID+_民安ともえ</tag>
|
56
|
+
<area>jp</area>
|
57
|
+
</tag_info>
|
58
|
+
<tag_info>
|
59
|
+
<tag>らいち♪</tag>
|
60
|
+
<area>jp</area>
|
61
|
+
</tag_info>
|
62
|
+
<tag_info>
|
63
|
+
<tag>ゆっくり実況プレイ最終回リンク</tag>
|
64
|
+
<area>jp</area>
|
65
|
+
</tag_info>
|
66
|
+
<tag_info>
|
67
|
+
<tag>ゆかりお母さん</tag>
|
68
|
+
<area>jp</area>
|
69
|
+
</tag_info>
|
70
|
+
<tag_info>
|
71
|
+
<tag>納得の感動</tag>
|
72
|
+
<area>jp</area>
|
73
|
+
</tag_info>
|
74
|
+
<tag_info>
|
75
|
+
<tag>ラストを飾る壮大なうっかり</tag>
|
76
|
+
<area>jp</area>
|
77
|
+
</tag_info>
|
78
|
+
<tag_info>
|
79
|
+
<tag>ゆかりさんの中の人巡回済み</tag>
|
80
|
+
<area>jp</area>
|
81
|
+
</tag_info>
|
82
|
+
</tags>
|
83
|
+
</video_info>
|
84
|
+
|
85
|
+
<video_info>
|
86
|
+
<video>
|
87
|
+
<id>sm9</id>
|
88
|
+
<deleted>0</deleted>
|
89
|
+
<title>新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師</title>
|
90
|
+
<description>レッツゴー!陰陽師(フルコーラスバージョン)</description>
|
91
|
+
<length_in_seconds>319</length_in_seconds>
|
92
|
+
<size_low>17436492</size_low>
|
93
|
+
<movie_type>flv</movie_type>
|
94
|
+
<thumbnail_url>http://tn-skr2.smilevideo.jp/smile?i=9</thumbnail_url>
|
95
|
+
<upload_time/>
|
96
|
+
<first_retrieve>2007-03-06T00:33:00+09:00</first_retrieve>
|
97
|
+
<default_thread>1173108780</default_thread>
|
98
|
+
<view_counter>13645663</view_counter>
|
99
|
+
<mylist_counter>134447</mylist_counter>
|
100
|
+
<option_flag_ichiba>0</option_flag_ichiba>
|
101
|
+
<option_flag_community>0</option_flag_community>
|
102
|
+
<option_flag_domestic>0</option_flag_domestic>
|
103
|
+
<option_flag_comment_type>0</option_flag_comment_type>
|
104
|
+
<option_flag_adult>0</option_flag_adult>
|
105
|
+
<option_flag_mobile>0</option_flag_mobile>
|
106
|
+
<option_flag_economy_mp4>1</option_flag_economy_mp4>
|
107
|
+
<option_flag_middle_video>0</option_flag_middle_video>
|
108
|
+
<option_flag_mobile_ng_apple>0</option_flag_mobile_ng_apple>
|
109
|
+
</video>
|
110
|
+
<thread>
|
111
|
+
<id>1173108780</id>
|
112
|
+
<public>1</public>
|
113
|
+
<num_res>4159811</num_res>
|
114
|
+
<community_id/>
|
115
|
+
</thread>
|
116
|
+
<tags>
|
117
|
+
<tag_info>
|
118
|
+
<tag>陰陽師</tag>
|
119
|
+
<area>jp</area>
|
120
|
+
</tag_info>
|
121
|
+
<tag_info>
|
122
|
+
<tag>レッツゴー!陰陽師</tag>
|
123
|
+
<area>jp</area>
|
124
|
+
</tag_info>
|
125
|
+
<tag_info>
|
126
|
+
<tag>公式</tag>
|
127
|
+
<area>jp</area>
|
128
|
+
</tag_info>
|
129
|
+
<tag_info>
|
130
|
+
<tag>音楽</tag>
|
131
|
+
<area>jp</area>
|
132
|
+
</tag_info>
|
133
|
+
<tag_info>
|
134
|
+
<tag>ゲーム</tag>
|
135
|
+
<area>jp</area>
|
136
|
+
</tag_info>
|
137
|
+
<tag_info>
|
138
|
+
<tag>最古の動画</tag>
|
139
|
+
<area>jp</area>
|
140
|
+
</tag_info>
|
141
|
+
<tag_info>
|
142
|
+
<tag>新・豪血寺一族</tag>
|
143
|
+
<area>jp</area>
|
144
|
+
</tag_info>
|
145
|
+
<tag_info>
|
146
|
+
<tag>元気の出る動画</tag>
|
147
|
+
<area>jp</area>
|
148
|
+
</tag_info>
|
149
|
+
<tag_info>
|
150
|
+
<tag>3月6日投稿動画</tag>
|
151
|
+
<area>jp</area>
|
152
|
+
</tag_info>
|
153
|
+
<tag_info>
|
154
|
+
<tag>sm9</tag>
|
155
|
+
<area>jp</area>
|
156
|
+
</tag_info>
|
157
|
+
</tags>
|
158
|
+
</video_info>
|
159
|
+
</nicovideo_video_response>
|
160
|
+
EOS
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require "nicoquery/object_mapper/video_array"
|
2
|
+
require "fixture/video_array_sm20415650_sm9"
|
3
|
+
|
4
|
+
|
5
|
+
describe "NicoQuery::ObjectMapper::VideoArray" do
|
6
|
+
before do
|
7
|
+
xml = Fixture.video_array_sm20415650_sm9
|
8
|
+
@result = NicoQuery::ObjectMapper::VideoArray.new xml
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "sm20415650" do
|
12
|
+
subject { @result.movies[0] }
|
13
|
+
|
14
|
+
describe "#title" do
|
15
|
+
it "returns string of title" do
|
16
|
+
expect(subject.title).to eq "【Minecraft】まったりクラフター生活 ~最終日~【ゆっくり実況】"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#video_id" do
|
21
|
+
it "returns number of mylist_id" do
|
22
|
+
expect(subject.video_id).to eq "sm20415650"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#publish_date" do
|
27
|
+
it "returns number of thread_id" do
|
28
|
+
expect(subject.publish_date).to eq Time.new(2013, 3, 23, 23, 10, 32)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#thumbnail_url" do
|
33
|
+
it "returns number of thread_id" do
|
34
|
+
expect(subject.thumbnail_url).to eq "http://tn-skr3.smilevideo.jp/smile?i=20415650"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#view_counter" do
|
39
|
+
it "returns number of view counter" do
|
40
|
+
expect(subject.view_counter).to be_a_kind_of(Fixnum)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#comment_num" do
|
45
|
+
it "returns number of comment num" do
|
46
|
+
expect(subject.comment_num).to be_a_kind_of(Fixnum)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#mylist_counter" do
|
51
|
+
it "returns number of mylist counter" do
|
52
|
+
expect(subject.mylist_counter).to be_a_kind_of(Fixnum)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#description.raw_text" do
|
57
|
+
it "returns string of title" do
|
58
|
+
# mylistのrssでは、descriptionの全文取得はできず、頭から256文字までしか取得できない。
|
59
|
+
# <br />が勝手に<br></br>に変換されてしまう。noriのせい?
|
60
|
+
expect(subject.description.raw_text).to eq "最終日。<br></br><br></br>ひっそりまったり通常営業...かな?<br></br>ついにきました最終日。最後に最長の尺...画質が悪いかもです><<br></br>今まで本当にありがとうございました!最後にゆっくりまったりしていってね(*´ヮ`*)<br></br><br></br>シード値:-2086770116<br></br><br></br>使用MOD<br></br>1.Opti Fine<br></br>2.MinecraftIM<br></br>3.PlayerFormLittleMaid<br></br>4.Audiotori r2<br></br>5.littleMaidMob<br></br>+りばいあ製MOD×2(らいちんぐすてっき・ゆかり&らいちロボ)<br></br><br></br>sm20221817←29日目⇔新シリーズ→sm21615389<br></br><br></br>シリーズまとめ→mylist/29017292<br></br>他に作ったもの→mylist/29022355<br></br><br></br>twitter⇒http://twitter.com/raichi_J<br></br>コミュco1590050<br></br><br></br>いただいたイラストclip/577830<br></br>ゆかりテクスチャim2807664<br></br>moyuさん作・ゆかりさんと私のメイドモデルim2466837"
|
61
|
+
# expect(subject.description.raw_text).to eq <<-EOS
|
62
|
+
# 最終日。<br /><br />ひっそりまったり通常営業...かな?<br />ついにきました最終日。最後に最長の尺...画質が悪いかもです><<br />今まで本当にありがとうございました!最後にゆっくりまったりしていってね(*´ヮ`*)<br /><br />シード値:-2086770116<br /><br />使用MOD<br />1.Opti Fine<br />2.MinecraftIM<br />3.PlayerFormLittleMaid<br />4.Audiotori r2<br />5.littleMaidMob<br />+りばいあ製MOD×2(らいちんぐすてっき・ゆかり&らいちロボ)<br /><br />sm20221817←29日目⇔新シリーズ→sm21615389<br /><br />シリーズまとめ→mylist/29017292<br />他に作ったもの→mylist/29022355<br /><br />twitter⇒http://twitter.com/raichi_J<br />コミュco1590050<br /><br />いただいたイラストclip/577830<br />ゆかりテクスチャim2807664<br />moyuさん作・ゆかりさんと私のメイドモデルim2466837
|
63
|
+
# EOS
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#description.mylist_references" do
|
68
|
+
it "returns number of mylist references" do
|
69
|
+
expect(subject.description.mylist_references).to eq [29017292, 29022355]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#tags" do
|
74
|
+
it "returns number of mylist references" do
|
75
|
+
expect(subject.tags).to be_a_kind_of Array
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nicoquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masami Yonehara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -235,19 +235,23 @@ files:
|
|
235
235
|
- lib/nicoquery/api/mylist_rss.rb
|
236
236
|
- lib/nicoquery/api/tag_search_rss.rb
|
237
237
|
- lib/nicoquery/api/video_array.rb
|
238
|
+
- lib/nicoquery/crawler/bulk_scraping.rb
|
238
239
|
- lib/nicoquery/crawler/tag_search.rb
|
239
240
|
- lib/nicoquery/object/movie.rb
|
240
241
|
- lib/nicoquery/object/mylist.rb
|
241
242
|
- lib/nicoquery/object/tag_search.rb
|
243
|
+
- lib/nicoquery/object_mapper/description.rb
|
242
244
|
- lib/nicoquery/object_mapper/getthumbinfo.rb
|
243
245
|
- lib/nicoquery/object_mapper/mylist_rss.rb
|
244
246
|
- lib/nicoquery/object_mapper/tag_search_rss.rb
|
247
|
+
- lib/nicoquery/object_mapper/video_array.rb
|
245
248
|
- lib/nicoquery/version.rb
|
246
249
|
- nicoquery.gemspec
|
247
250
|
- spec/api/getthumbinfo_spec.rb
|
248
251
|
- spec/api/mylist_rss_spec.rb
|
249
252
|
- spec/api/tag_search_spec.rb
|
250
253
|
- spec/api/video_array_spec.rb
|
254
|
+
- spec/crawler/bulk_scraping_spec.rb
|
251
255
|
- spec/crawler/tag_search_spec.rb
|
252
256
|
- spec/fixture/getthumbinfo_sm20415650.rb
|
253
257
|
- spec/fixture/mylist_rss_18266317.rb
|
@@ -256,12 +260,14 @@ files:
|
|
256
260
|
- spec/fixture/tag_search_403.rb
|
257
261
|
- spec/fixture/tag_search_item.rb
|
258
262
|
- spec/fixture/tag_search_meta.rb
|
263
|
+
- spec/fixture/video_array_sm20415650_sm9.rb
|
259
264
|
- spec/nicoquery_spec.rb
|
260
265
|
- spec/object/movie_spec.rb
|
261
266
|
- spec/object/mylist_spec.rb
|
262
267
|
- spec/object/tag_search_rss_spec.rb
|
263
268
|
- spec/object_mapper/getthumbinfo_spec.rb
|
264
269
|
- spec/object_mapper/mylist_rss_spec.rb
|
270
|
+
- spec/object_mapper/video_array_spec.rb
|
265
271
|
- spec/spec_helper.rb
|
266
272
|
homepage: ''
|
267
273
|
licenses:
|
@@ -292,6 +298,7 @@ test_files:
|
|
292
298
|
- spec/api/mylist_rss_spec.rb
|
293
299
|
- spec/api/tag_search_spec.rb
|
294
300
|
- spec/api/video_array_spec.rb
|
301
|
+
- spec/crawler/bulk_scraping_spec.rb
|
295
302
|
- spec/crawler/tag_search_spec.rb
|
296
303
|
- spec/fixture/getthumbinfo_sm20415650.rb
|
297
304
|
- spec/fixture/mylist_rss_18266317.rb
|
@@ -300,10 +307,12 @@ test_files:
|
|
300
307
|
- spec/fixture/tag_search_403.rb
|
301
308
|
- spec/fixture/tag_search_item.rb
|
302
309
|
- spec/fixture/tag_search_meta.rb
|
310
|
+
- spec/fixture/video_array_sm20415650_sm9.rb
|
303
311
|
- spec/nicoquery_spec.rb
|
304
312
|
- spec/object/movie_spec.rb
|
305
313
|
- spec/object/mylist_spec.rb
|
306
314
|
- spec/object/tag_search_rss_spec.rb
|
307
315
|
- spec/object_mapper/getthumbinfo_spec.rb
|
308
316
|
- spec/object_mapper/mylist_rss_spec.rb
|
317
|
+
- spec/object_mapper/video_array_spec.rb
|
309
318
|
- spec/spec_helper.rb
|