nicoscraper 0.2.8 → 0.2.9
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.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/classes/parser.rb +15 -19
- data/nicoscraper.gemspec +1 -1
- data/test/movie_spec.rb +1 -0
- data/test/mylist_spec.rb +3 -3
- metadata +2 -2
data/README.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.9
|
data/lib/classes/parser.rb
CHANGED
|
@@ -43,9 +43,7 @@ module Nicos
|
|
|
43
43
|
parsed[label] = Nicos::Converter.iso8601ToUnix(doc.value)
|
|
44
44
|
when "length"
|
|
45
45
|
doc.read
|
|
46
|
-
|
|
47
|
-
length = lengthStr[0].to_i * 60 + lengthStr[1].to_i
|
|
48
|
-
parsed["length"] = length
|
|
46
|
+
parsed["length"] = Nicos::Converter.toSeconds(doc.value)
|
|
49
47
|
when "tags"
|
|
50
48
|
doc.move_to_attribute("domain")
|
|
51
49
|
category = doc.value
|
|
@@ -84,42 +82,40 @@ module Nicos
|
|
|
84
82
|
parsed[n] = {}
|
|
85
83
|
when "title"
|
|
86
84
|
doc.read
|
|
87
|
-
parsed[n]["title"] =
|
|
85
|
+
parsed[n]["title"] = doc.value
|
|
88
86
|
when "link"
|
|
89
87
|
doc.move_to_attribute("href")
|
|
90
|
-
parsed[n]["video_id"] =
|
|
88
|
+
parsed[n]["video_id"] = doc.value.split('/')[4]
|
|
91
89
|
when "published", "updated"
|
|
92
90
|
label = doc.name
|
|
93
91
|
doc.read
|
|
94
|
-
parsed[n][label] =
|
|
92
|
+
parsed[n][label] = Nicos::Converter.iso8601ToUnix(doc.value)
|
|
95
93
|
when "p"
|
|
96
94
|
doc.move_to_attribute("class")
|
|
97
95
|
case doc.value
|
|
98
96
|
when "nico-thumbnail"
|
|
99
97
|
doc.read
|
|
100
98
|
doc.move_to_attribute("src")
|
|
101
|
-
parsed[n]["thumbnail_url"] =
|
|
99
|
+
parsed[n]["thumbnail_url"] = doc.value
|
|
102
100
|
when "nico-description"
|
|
103
101
|
doc.read
|
|
104
|
-
parsed[n]["description"] =
|
|
102
|
+
parsed[n]["description"] = doc.value
|
|
105
103
|
end
|
|
106
104
|
when "strong"
|
|
107
105
|
doc.move_to_attribute("class")
|
|
108
106
|
case doc.value
|
|
109
107
|
when "nico-info-length"
|
|
110
108
|
doc.read
|
|
111
|
-
|
|
112
|
-
length = lengthStr[0].to_i * 60 + lengthStr[1].to_i
|
|
113
|
-
parsed[n]["length"] = length
|
|
109
|
+
parsed[n]["length"] = Nicos::Converter.toSeconds(doc.value)
|
|
114
110
|
when "nico-info-date"
|
|
115
111
|
label = doc.name
|
|
116
112
|
doc.read
|
|
117
|
-
parsed[n]["first_retrieve"] =
|
|
118
|
-
|
|
113
|
+
parsed[n]["first_retrieve"] = Nicos::Converter.japToUnix(doc.value)
|
|
114
|
+
when "nico-numbers-view", "nico-numbers-res",
|
|
119
115
|
"nico-numbers-mylist"
|
|
120
116
|
label = doc.value
|
|
121
117
|
doc.read
|
|
122
|
-
parsed[n][label.slice(13,99)] =
|
|
118
|
+
parsed[n][label.slice(13,99)] = Nicos::Converter::commaRemover(doc.value)
|
|
123
119
|
end
|
|
124
120
|
end
|
|
125
121
|
end
|
|
@@ -201,20 +197,20 @@ module Nicos
|
|
|
201
197
|
/(<p\sclass\=\"nico-description\"\>)([^\<]{1,})/ =~ html
|
|
202
198
|
description = $2
|
|
203
199
|
|
|
204
|
-
/(<
|
|
205
|
-
length = $2
|
|
200
|
+
/(<strong\sclass\=\"nico-info-length\"\>)([^\<]{1,})/ =~ html
|
|
201
|
+
length = Nicos::Converter.toSeconds($2)
|
|
206
202
|
|
|
207
203
|
/(<strong\sclass\=\"nico-info-date\"\>)([^\<]{1,})/ =~ html
|
|
208
204
|
first_retrieve = Nicos::Converter.japToUnix($2)
|
|
209
205
|
|
|
210
206
|
/(<strong\sclass\=\"nico-numbers-view\"\>)([^\<]{1,})/ =~ html
|
|
211
|
-
view = $2
|
|
207
|
+
view = Nicos::Converter.commaRemover($2)
|
|
212
208
|
|
|
213
209
|
/(<strong\sclass\=\"nico-numbers-res\"\>)([^\<]{1,})/ =~ html
|
|
214
|
-
res = $2
|
|
210
|
+
res = Nicos::Converter.commaRemover($2)
|
|
215
211
|
|
|
216
212
|
/(<strong\sclass\=\"nico-numbers-mylist\"\>)([^\<]{1,})/ =~ html
|
|
217
|
-
mylist = $2
|
|
213
|
+
mylist = Nicos::Converter.commaRemover($2)
|
|
218
214
|
|
|
219
215
|
parsed["entry"][n]["memo"] = memo
|
|
220
216
|
parsed["entry"][n]["thumbnail_url"] = thumbnail_url
|
data/nicoscraper.gemspec
CHANGED
data/test/movie_spec.rb
CHANGED
data/test/mylist_spec.rb
CHANGED
|
@@ -27,9 +27,9 @@ describe Nicos::Movie, "After executiton of 'getInfo' method" do
|
|
|
27
27
|
movieObj.thumbnail_url.should_not be_nil
|
|
28
28
|
movieObj.length .should_not be_nil
|
|
29
29
|
|
|
30
|
-
movieObj.view_counter .should_not
|
|
31
|
-
movieObj.comment_num .should_not
|
|
32
|
-
movieObj.mylist_counter.should_not
|
|
30
|
+
movieObj.view_counter .should_not == 0
|
|
31
|
+
movieObj.comment_num .should_not == 0
|
|
32
|
+
movieObj.mylist_counter.should_not == 0
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: nicoscraper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.2.
|
|
5
|
+
version: 0.2.9
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Masami Yonehara
|
|
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
145
145
|
requirements:
|
|
146
146
|
- - ">="
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
|
-
hash:
|
|
148
|
+
hash: 3267649262953324445
|
|
149
149
|
segments:
|
|
150
150
|
- 0
|
|
151
151
|
version: "0"
|